There is no function to know the size of the file in C language.
Move and request the file pointer to know the size of the file after opening the file.
Fpos_t is a variable that means the size of data, and the realities are the integral values without the sign. There is very no problem even if it changes it into int.fpos_t GetFileSize(const char *FileName[]) { fpos_t fsize = 0; FILE *fp = fopen(FileName,"rb"); /* The size of the file is investigated */ Fseek(fp,0,SEEK_END); fgetpos(fp,&fsize); fclose(fp); return fsize; }
fpos_t fsize = 0; fpos_t fsizeb = fseek(fp,0,SEEK_END); fgetpos(fp,&fsize); fseek(fp,fsizeb,SEEK_SET);