Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how fread works in C?
  2. 12345678901222344567
  3.        
  4. FILE * pFile;
  5.   int c;
  6.   char buffer [256];
  7.   pFile = fopen ("myfile.txt","r");
  8.   int a[50] = {0};
  9.   fread(a, sizeof(a[0]), 5, pFile);
  10.   fclose(pFile);
  11.   for (c = 0; c < 5; c++)
  12.   {
  13.     printf("%dn", a[c]);
  14.   }
  15.        
  16. Memory Address    Byte In Memory        Little-endian
  17.   0x12345678        00110001     <----least significant byte
  18.   0x12345679        00110010
  19.   0x12345680        00110011
  20.   0x12345681        00110100     <----most significant byte