Windows file manipulation with C

Ravi Mahadevan's Avatar, Join Date: Jan 2011
Newbie Member
In Windows 2003 when application modifies a binary file - size of the file and last time modified have not been affected because the file was created as a fixed size file. But my application need to find out based on some file attribute whether file content is changed or not since last access. Can you please suggest a api or system call to be used in windows "C" programming to achieve this?. At present "GetFileTime" and "GetFileSize" APIs are being used but that does not dectect when the file is modified.
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
You could keep a copy of the file and do a byte-by-byte check.
Or you could calculate the MD5 of the file's content and store that.

Either method will show up any difference in the file content.
Ravi Mahadevan like this
0
Ravi Mahadevan's Avatar, Join Date: Jan 2011
Newbie Member
Thank you for your inputs.

You could keep a copy of the file and do a byte-by-byte check - I guess, this would really consume lots of time since the application file size is very huge I would not go for it

Or you could calculate the MD5 of the file's content and store that. - Seems to be a good idea. Let me try this