Answers for "how to check the size of a file in c"

C
1

c get file size

FILE *fp = fopen("example.txt", "r");
fseek(fp, 0L, SEEK_END);
int size = ftell(fp);
Posted by: Guest on March-09-2021
0

sizeof file c

FILE *fp = fopen("file.txt", "w+");
fseek(fp,0,SEEK_END);
int size = ftell(fp) + 1; // we have to account for the 0th position in the file
Posted by: Guest on April-26-2022

Code answers related to "how to check the size of a file in c"

Code answers related to "C"

Browse Popular Code Answers by Language