National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-3 LabWindows/CVI Standard Libraries
The Data Formatting function panels perform intricate formatting operations with a single
function call.
Formatting Functions, a subclass of Data Formatting, contains function panels that
combine and format one or more source items into a single target item.
Scanning Functions, a subclass of Data Formatting, contains function panels that
transform a single source item into several target items.
Status Functions, a subclass of Data formatting, contains function panels that return
information about the success or failure of a formatting or scanning call.
The online help with each panel contains specific information about operating each function
panel.
The String Manipulation Functions
The functions in the String Manipulation class perform common operations such as copying one
string to another, comparing two strings, or finding the occurrence of a string in a character
buffer. These functions are similar in purpose to the standard C string functions.
The Special Nature of the Formatting and Scanning Functions
The formatting and scanning functions are different in nature from the other functions in the
LabWindows/CVI libraries. With few exceptions, each LabWindows/CVI library function has a
fixed number of parameters, and each parameter has a definite data type. Each formatting and
scanning function, however, takes a variable number of parameters, and the parameters can be of
various data types. This difference is necessary to give the formatting and scanning functions
versatility.
For instance, a single Scan function call performs disparate operations, such as the following.
Find the two numeric values in the string:
"header: 45, -1.03e-2"
and place the first value in an integer variable and the second in a real variable.
Take the elements from an integer array, swap the high and low bytes in each element, and
place the resulting values in a real array.
To perform these operations, each formatting and scanning function takes a format string as one
of its parameters. In effect, a format string is a mini-program that instructs the formatting and
scanning functions on how to transform the input arguments to the output arguments. For
conciseness, format strings are constructed using single-character codes. These codes are