GetFileInfo
- Updated2023-02-21
- 1 minute(s) read
GetFileInfo
int GetFileInfo (char fileName[], ssize_t *fileSize);
Purpose
Verifies whether a file exists. Returns an integer value of zero if no file exists and one if the file exists. fileSize is a ssize_t variable that contains the file size in bytes or zero if no file exists.
Example Code
/* 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;
ssize_t size;
n = GetFileInfo("a:\data\test1.dat",&size);
if (n == 0)
FmtOut("File does not exist.");
else
FmtOut("File size = %i[b0]",size);
Parameters
Input | ||
Name | Type | Description |
fileName | char [] | Pathname of the file to check. |
Output | ||
Name | Type | Description |
fileSize | ssize_t | File size in bytes. fileSize is zero if no file exists. |
Return Value
Name | Type | Description | ||||||||
filePresent | int | Indicates whether the specified file exists.
You can use GetFmtIOError to get more information about the type of error that occurred. |
Additional Information
Library: Formatting and I/O Library
Include file: formatio.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later