└── fseek() and ftell() function /fseek() and ftell() function: -------------------------------------------------------------------------------- 1 | /*C program to find the size of a file in Linux and Windwos.*/ 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | FILE* fp; /*to create file*/ 8 | long int size = 0; 9 | 10 | /*Open file in Read Mode*/ 11 | fp = fopen("temp.txt", "r"); 12 | 13 | /*Move file point at the end of file.*/ 14 | fseek(fp, 0, SEEK_END); 15 | 16 | /*Get the current position of the file pointer.*/ 17 | size = ftell(fp); 18 | 19 | if (size != -1) 20 | printf("File size is: %ld\n", size); 21 | else 22 | printf("There is some ERROR.\n"); 23 | 24 | return 0; 25 | } 26 | --------------------------------------------------------------------------------