Example: sscanf

The following example uses sscanf to read the string sentence and retrieve the first 3 elements from it. It then sends these elements, s1, num_of_years, and s2, in an output message.

    char sentence[] = "After 7 years' siege yet Troy walls stand";
    char s1[32], s2[32];
    int num_of_years;
    sscanf(sentence,"%s %d %s", s1, &num_of_years, s2);
    lr_output_message ("Number of years=%d s2=\"%s\"", num_of_years, s2);
Example: Output:
Action.c(7): Number of years=7 s2="years'"