LabWindows/CVI

Content Type
Programming Language
Current manual

GetFileInfo

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.

Code Description
1 File exists.
0 File does not exist.
–1 Maximum number of files already open.

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

Was this information helpful?

Help us improve your future ni.com experience.

Did you find the documentation you were looking for?

Submit