| Summary | |
#include <stdio.h>
U32 fread (
void *buffer, /* storage buffer for data */
U32 size, /* size of each item */
U32 count, /* number of items to read */
FILE *stream); /* file stream to read from */
|
| Description | | The fread function reads, from the input stream, up to count items of size bytes and stores them in buffer. The file pointer associated with stream is increased by the number of bytes actually read. The fread function is in the RL-FlashFS library. The prototype is defined in stdio.h. |
| Return Value | | The fread function returns the number complete items actually read. This number may be less than count if an error occurs or if the end-of-file is reached. Use the feof or ferror functions to distinguish an error from end-of-file. |
| See Also | | feof, ferror, fgetc, fgets, fwrite |
| Example | |
#include <rtl.h>
#include <stdio.h>
void tst_fread (void) {
int count[10];
FILE *fin;
fin = fopen ("Counter.log","r");
if (fin == NULL) {
printf ("File not found!\n");
}
else {
fread (&count[0], sizeof (int), 10, fin);
fclose (fin);
}
}
|