setFileModificationTime()
This function sets/changes the last modification date and time of a file.
Synopsis
int setFileModificationTime( string PathFilename, time mtime);
Parameters
Parameter | Meaning |
---|---|
PathFilename | Path and file name, for example, "C:/Dokumentation/Test.bmp". |
mtime | Date and time that shall be set. Therefore use the makeTime() function . |
Return value
Return 0, if date and time were set.
Return -1, if an error occurs.
Description
This function sets/changes the last modification date and time of a file.
Under Linux negative times can be used but not under Windows. If, for example, the time (time) -1 is set, the time 1970.01.01 01:00:00.000000000 is set under Windows. Under Linux again the time (time)-1 seconds meaning 1970.01.01 00:59:59.000000000 is set.
Example
The following example returns the modification date and time of the file. In order to execute the example, the files have to exist and have to be located in the correct directory.
main()
{
time time;
string test
time modTime;
test = "C:/Dokumentation/Test.bmp";
time = getFileModificationTime(test);
DebugN("Modificated:", test, time);
modTime = makeTime(2008,12,24,14,21,23);
setFileModificationTime(test, modTime);
}
Assignment
File functions
Availability
CTRL