Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- int main()
- {
- struct stat st;
- FILE *f=fopen("test.bin","wb");
- int nr1=5,nr2=7,result;
- if (!f)
- return 1;
- fwrite(&nr1,sizeof(int),1,f);
- fwrite(&nr2,sizeof(int),1,f);
- fclose(f);
- result=stat("test.bin",&st);
- if (result)
- printf("Error getting information!\n");
- else
- printf("%d\n",st.st_size);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement