int GetFileInfo (char *fileName, long *fileSize);
Verifies whether a file exists. Returns an integer value of zero if no file exists and one if the file exists. fileSize is a long variable that contains the file size in bytes or zero if no file exists.
/* Check for presence of file A:\DATA\TEST1.DAT. */
/* Print its size if file exists or message that states file does not exist. */
int n;
long size;
n = GetFileInfo("a:\\data\\test1.dat",&size);
if (n == 0)
FmtOut("File does not exist.");
else
FmtOut("File size = %i[b4]",size);
Input | ||
Name | Type | Description |
fileName | string | Pathname of the file to check. |
Output | ||
Name | Type | Description |
fileSize | long | File size in bytes. fileSize is zero if no file exists. |
Name | Type | Description | ||||||||
status | integer | Indicates whether the specified file exists.
You can use GetFmtIOError to get more information about the type of error that occurred. |