| 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 function fread reads a number of items with a given size from a data stream to a buffer. The parameter buffer is a void pointer to a buffer to store the items read. The parameter size defines the item size in bytes. The parameter count defines the number of items to read. The parameter stream is a file pointer defining the data stream to read. The function is included in the library RL-FlashFS. The prototype is defined in the file stdio.h. |
| Return Value | - number of items read - on success. This number could be smaller than count if an error occurred or the end-of-file condition was reached.
Note - The file position indicator is undefined when errors occurred.
|
| 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) {
fread (&count[0], sizeof (int), 10, fin);
fclose (fin);
}
}
|