SW006013 Microchip Technology, SW006013 Datasheet - Page 64

MPLAB C Compiler For DsPIC DSCs

SW006013

Manufacturer Part Number
SW006013
Description
MPLAB C Compiler For DsPIC DSCs
Manufacturer
Microchip Technology
Series
DsPIC30F/33Fr
Type
MPLAB® C Compilerr
Datasheet

Specifications of SW006013

Supported Families
DsPIC30F, DsPIC33F
Core Architecture
DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
DsPIC30F And DsPIC33F
Tool Function
Compiler
Tool Type
Compiler
Processor Series
dsPIC
Lead Free Status / RoHS Status
na
For Use With/related Products
dSPIC DSCs
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
DS51456E-page 60
fread
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Reads data from the stream.
<stdio.h>
size_t fread(void *ptr, size_t size, size_t nelem,
FILE *stream);
ptr
size
nelem
stream
Returns the number of complete elements read up to nelem whose
size is specified by size.
The function reads characters from a given stream into the buffer
pointed to by ptr until the function stores size * nelem characters
or sets the end-of-file or error indicator. fread returns n/size where n is
the number of characters it read. If n is not a multiple of size, the value
of the last element is indeterminate. If the function sets the error indica-
tor, the file-position indicator is indeterminate.
#include <stdio.h> /* for fread, fwrite,
int main(void)
{
}
FILE *buf;
int x, numwrote, numread;
double nums[10], readnums[10];
if ((buf = fopen("afile.out", "w+")) != NULL)
{
else
for (x = 0; x < 10; x++)
{
}
numwrote = fwrite(nums, sizeof(double),
printf("Wrote %d numbers\n\n", numwrote);
fclose(buf);
printf("Cannot open afile.out\n");
nums[x] = 10.0/(x + 1);
printf("10.0/%d = %f\n", x+1, nums[x]);
pointer to the storage buffer
size of item
maximum number of items to be read
pointer to the stream
/* printf, fopen, fclose, */
/* sizeof, FILE, NULL
10, buf);
© 2008 Microchip Technology Inc.
*/
*/

Related parts for SW006013