Guardian C Library Calls Reference Manual
stcarg (supplementary)
3-174 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
stcarg (supplementary)
The stcarg function scans a string until it finds one of the characters from another
specified string.
str1_ptr
points to the string to scan.
str2_ptr
points to the string to scan for.
Return Value
is the number of characters scanned in *str1_ptr, or the length of *str1_ptr if none
of the characters are found.
Usage Guidelines
•
The stcarg function scans a string until it finds one of the characters in the other
string, or until it encounters a null character.
•
While scanning the string, stcarg ignores text that is inside single or double
quotation marks, or text that follows an unmatched single or double quotation mark.
It also ignores any characters that are preceded by a backslash character.
Example
This example prints “token_number_1”, which is the string of characters that precedes
the first break character:
#include <stringh>
#include <stdioh>
int main(void)
{
int indx; /* loop control index */
int length; /* length of current token */
char *text; /* pointer to text to be processed */
char *break_chars; /* chars which end an argument */
break_chars=";: !."; /* chars which end an argument */
text = "token_number_1 12345;abc";
length = stcarg(text, break_chars);
for(indx=0; indx<length; indx++)
printf("%c", text[indx]);
printf("\n");
}
#include <stringh>
size_t stcarg(char *str1_ptr, char *str2_ptr);