National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-17 LabWindows/CVI Standard Libraries
Using This Function
The return value indicates how many source format specifiers were satisfied, -1 if the format
string is in error, or -2 if there was an I/O error. A complete discussion of this function is in the
Using the Formatting and Scanning Functions section later in this chapter.
GetFileInfo
int status = GetFileInfo (char *fileName, long *fileSize);
Purpose
Verifies if a file exists. Returns an integer value of zero if no file is present and 1 if file is
present. fileSize is a long variable that contains the file size in bytes or zero if no file exists.
Parameters
Input
fileName
string Pathname of the file to be
checked.
Output
fileSize
long File size or zero.
Return Value
status
integer Indicates if the file exists.
Return Codes
1
File exists.
0
File does not exist.
-1
Maximum number of files already open.
Example
/* Check for presence of file A:\DATA\TEST1.DAT. */
/* Print its size */
/* if file exists or message stating 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);