#include #include #include int main(int argc, char *args[]) { void wait(int sec) { clock_t end_wait; end_wait = clock() + sec * CLK_TCK; } while(clock() < end_wait) { //output size to report } wait(5); //define structure to hold file size struct stat statbuf; //declare pointers FILE *in, *out; //opens file for reading in = fopen("g:/dev-cpp/file1.txt", "r"); //use fstat to acquire filesize fstat(fileno(in), &statbuf); long x; int temp = 0; fclose(in); // clock end // int x, temp = 0 // while(clock() < end) // { if(x!=temp) { out = fopen( "g:/dev-cpp/report.txt", "a" ); if (out != NULL) { fprintf(out, "Size of file on: is: %ld\n ", statbuf.st_size ); printf("Size of file in bytes: %ld\n", statbuf.st_size); statbuf.st_size = x; fclose(out); } } temp = x; } system( "PAUSE"); return 0; }