getFileModificationTime()

The function returns the modification date and time of a file.

Synopsis

time getFileModificationTime(string PathFilename);

Parameters

Parameter Meaning
PathFilename Path and file name, for example, "C:/Dokumentation/Test.bmp". See example at the end of this page for more file examples.

Return value

The function returns the modification time or zero time in case of errors.

Description

Returns the modification date and time of a file.

If the file path of the file contains empty spaces or cyrillic characters, the function returns the default time under Windows. Under Linux, the file modification time of the specified file is returned.

Example

The following example returns the modification date and time of the three different files "Test.bmp", "picture1.bmp" and "report.doc". The example shows how to specify a local file, a file located on a network drive and a file on a network drive using the drive letter. In order to execute the example, the files have to exist and have to be located in the correct directory.

main()
{
  time z;
  int i;
  string test1, test2, test3, test4;
  test1 = "C:/Dokumentation/Test.bmp";
  test2 = "//Eis2k215/data/picture1.bmp";
  test3 = "Z:/Projects/report.doc";
  z = getFileModificationTime(test1);
  DebugN("Modification time of ", test1, z);
  z = getFileModificationTime(test2);
  DebugN("Modification time of", test2, z);
  z = getFileModificationTime(test3);
  DebugN("Modification time of", test3, z);
}

Assignment

File function

Availability

CTRL, UI