SetFileTime

int SetFileTime (char fileName[], int hours, int minutes, int seconds);

Purpose

Sets the last modification time of a file.

Note   Windows SDK also contains a SetFileTime function. If you include windows.h and do not include utility.h, you will receive compile errors if you call the SetFileTime function.

Parameters

Input
Name Type Description
fileName string The pathname of the file for which to set the time.

If you specify an empty string "", SetFileTime sets the time of the file found by the most recent call to GetFirstFile or GetNextFile.
hours integer The hours component of the time.

Values: 0 to 23
minutes integer The minutes component of the time.

Values: 0 to 59
seconds integer The seconds component of the time.

You can specify only an even number of seconds. If you specify an odd number of seconds, the number is rounded down.

Values: 0 to 58

Return Value

Name Type Description
result integer The result of the call.

Code Description
0 Success.
-1 File not found or directory in path not found.
-3 General I/O error occurred.
-4 Insufficient memory to complete the operation.
-5 Invalid time, or invalid path; for example, c:filename.
-6 Access denied.