Reputation: 5463
How to detect whether a file is modified in iOS?
I don't mean the real-time monitoring, because while the application is gone, it won't detect anymore.
I've checked the attributes of the file, and couldn't find the satisfied one.(Did I miss something?)
There maybe some check-sum generating solutions, but they will require much time. (Is there any cheap check-sum generating algorithm?)
Upvotes: 2
Views: 1636
Reputation: 96947
Which attributes did you check? With fstat()
, you should be able to compare the st_mtime
attribute of a file with a previously stored value.
Upvotes: 1
Reputation: 122391
You can use stat
(reference), to get the modification time of the file. You could then compare it against your stored value:
struct stat sb;
if (stat("/path/to/file", &sb) == 0)
{
... compare sb.st_mtimespec with stored value
}
else
{
... report error
}
This question is pretty close to yours.
Upvotes: 2