Advertisement
printesoi

Untitled

May 20th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4. #include <io.h>
  5.  
  6. int main()
  7. {
  8.     struct stat st;
  9.     FILE *f=fopen("test.bin","wb");
  10.     int nr1=5,nr2=7,result;
  11.     size_t size;
  12.    
  13.     if (!f)
  14.         return 1;
  15.    
  16.     fwrite(&nr1,sizeof(int),1,f);
  17.     fwrite(&nr2,sizeof(int),1,f);
  18.    
  19.         fflush(f);
  20.  
  21.     size=filelength(fileno(f));
  22.    
  23.         fclose(f);
  24.     printf("%d\n",size);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement