• C

File attriibute modified???

Can anyone tell me how to check to see if a file has been modified since it was last read in?  I'm using C++, and running on a dos platform.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DOS function 0x43 is Change File Mode. It allows you to set or read the attribute associated with a file. DOS resets the archive bit whenever a file is modified. So if you set the archive bits on any files you wish to monitor. Then, after that, whenever you find the bit has been reset, you will know the file has been modified in the interim.

DOS function calls are initiated by placing the function number in AH, any parameters, then issueing a interrupt type 0x21.
Parameters in this case are DS:DX to point to a string with drive path and filename of file. If AL is 1, the file attribute will be set to the contents of CX. If it is 0, the file attribute will be returned in CX.

OR, depending on what compiler you are using, there should be some function in the library that will do a doscall for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
P.S. the archive bit is bit 5, i.e. mask with 0x20.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.