
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 0.49 KB | hits: 9 | expires: Never
how fread works in C?
12345678901222344567
FILE * pFile;
int c;
char buffer [256];
pFile = fopen ("myfile.txt","r");
int a[50] = {0};
fread(a, sizeof(a[0]), 5, pFile);
fclose(pFile);
for (c = 0; c < 5; c++)
{
printf("%dn", a[c]);
}
Memory Address Byte In Memory Little-endian
0x12345678 00110001 <----least significant byte
0x12345679 00110010
0x12345680 00110011
0x12345681 00110100 <----most significant byte