How to check in c , linux if a file has been updated/changed .
I want to check a file for update before opening the file and performing extraction/ i/o operations from it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Look at the man page for
stat(2). Get thest_mtimemember of thestruct statstructure, which will tell you the modification time of the file. If the current mtime is later than a prior mtime, the file has been modified.An example:
Here’s an introduction to
inotify, if that’s what you’re looking for.