Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 8

sscanf()

Scan input from a character string

Synopsis:

#include <stdio.h>

int sscanf( const char* in_string,
            const char* format,
            ... );

Arguments:

in_string
The string that you want to read from.
format
A string that specifies the format of the input. For more information, see scanf(). The formatting string determines what additional arguments you need to provide.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The sscanf() function scans input from the character string in_string, under control of the argument format. Following the format string is the list of addresses of items to receive values.

Returns:

The number of input arguments for which values were successfully scanned and stored, or EOF when the scanning is terminated by reaching the end of the input string.

Examples:

#include <stdio.h>
#include <stdlib.h>

int main( void )
  {
    int day, year;
    char weekday[20], month[20];

    sscanf( "Thursday February 0025 1999",
      "%s %s %d  %d",
      weekday, month, &day, &year );
    printf( "%s %d, %d is a %s\n",
     month, day, year, weekday );
    return EXIT_SUCCESS;
  }

produces the following:

February 25, 1999 is a Thursday

Classification:

ANSI, POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler Read the Caveats
Thread Yes

Caveats:

It's safe to call this function in a signal handler if the data isn't floating point.

See also:

fscanf(), fwscanf(), scanf(), swscanf(), vfscanf(), vfwscanf(), vscanf(), vsscanf(), vswscanf(), vwscanf(), wscanf()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 162

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sscanf.html on line 162