National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-25 LabWindows/CVI Standard Libraries
ScanFile
int
n
=
ScanFile
(
int
fileHandle,
char *
formatString,
targetptr1
,…,
targetptrn);
Purpose
Performs the same basic operation as the Scan function, except that the source material is
obtained from the file referred to by the
fileHandle
argument, which is obtained by calling the
LabWindows/CVI function OpenFile.
Parameters
Input
fileHandle
Integer.
formatString
String.
Output
targetptr1,…,targetptrn
Types must match
formatString
contents.
Return Value
n
integer Number of target format
specifiers satisfied.
Return Codes
-1
Format string error.
-2
I/O error.
Using This Function
The amount of data read from the file depends on the amount needed to fulfill the formats in the
format string. The return value indicates how many target 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.
ScanIn
int
n
=
ScanIn
(
char *
formatString,
targetptr1
,…,
targetptrn);
Purpose
Performs the same basic operation as the ScanFile function, except that the source material is
obtained from STDIN.