Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Windows file manipulation with C (http://www.go4expert.com/forums/windows-file-manipulation-c-t24392/)

Ravi Mahadevan 5Jan2011 14:38

Windows file manipulation with C
 
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.

xpi0t0s 6Jan2011 13:43

Re: Windows file manipulation with C
 
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 6Jan2011 17:46

Re: Windows file manipulation with C
 
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


All times are GMT +5.5. The time now is 19:24.