I am trying to complete a uni assignment - which is to capture the stat information of a file, save the stat info to a file - and then later retreive the information and compare it the the current stat info - to see if there have been any changes to the original file stat info.
So far I have the following:
#include <sys/type.h>
#include <sys/stat.h>
#include <stdio.h>
main()
{
struct stat file_info;
FILE *fp;
fp = fopen("myfile", "w");
stat("testfile", &file_info);
fprintf(fp, %d\n", file_info);
fclose(fp);
exit(0);
}
I think there are problems with the fprintf statement - I am not sure about the %d (as I guess the info is not all integers) - but an not sure what to put there in order to capture the entire stat information into myfile.
I would appreciate any help...
Many thanks
Sue