/*
get file size in c language
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/unistd.h>
int main(){
FILE *fp = fopen("test.txt", "r");
fseek(fp, 0L, SEEK_END);
int size = ftell(fp);
printf("file size: %d",size);
return 0;
}Source:www.lautturi.com