National Instruments 320682C Musical Toy Instrument User Manual


 
Formatting and I/O Library Chapter 2
LabWindows/CVI Standard Libraries 2-14 © National Instruments Corporation
Return Value
ndx
integer
Index in buffer where pattern
was found.
Return Code
-1
Pattern not found.
Parameter Discussion
The buffer searched is the set of numberofBytes bytes starting at position startingIndex of
buffer. Exception: If numberofBytes is -1, the buffer searched is the set of bytes starting at
position startingIndex of buffer up to the first ASCII NUL. startingIndex is zero-based.
If caseSensitive is zero, alphabetic characters are compared without regard to case. If
caseSensitive is non-zero, alphabetic characters are considered equal only if they have the same
case. If startFromRight is zero, the leftmost occurrence of the pattern in the buffer will be
found. If startFromRight is non-zero, the rightmost occurrence of the pattern in the buffer will
be found.
If the pattern is found, pattern returns the index relative to the beginning of buffer where it
found the first byte of the pattern. If the pattern is not found, pattern returns -1.
The following example returns 4, which is the index of the second of the three occurrences of
ab
in the string
1ab2ab3ab4
. The first occurrence is skipped because startingIndex is 3. Of the
two remaining occurrences, the leftmost is found because startFromRight is zero:
ndx = FindPattern ("1ab2ab3ab4", 3, -1, "AB", 0, 0);
On the other hand, the following line returns 7, which is the index of the last occurrence of
ab
,
because startFromRight is non-zero:
ndx = FindPattern ("1ab2ab3ab4", 3, -1, "AB", 0, 1);
Fmt
int
n = Fmt (
void
*target,
char
*formatString, source1,...,sourcen);
Purpose
Formats the source1 ... sourcen arguments according to descriptions in the formatString
argument.