scanf - SCANF(3) Linux Programmer’s Manual SCANF(3) NAME...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
SCANF(3) Linux Programmer’sManual SCANF(3) NAME scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conversion SYNOPSIS #include <stdio.h> int scanf( const char * format ,... ); int fscanf( FILE * stream ,const char * format ,... ); int sscanf( const char * str ,const char * format ,... ); #include <stdarg.h> int vscanf( const char * format ,va_list ap ); int vsscanf( const char * str ,const char * format ,va_list ap ); int vfscanf( FILE * stream ,const char * format ,va_list ap ); DESCRIPTION The scanf family of functions scans input according to a format as described below. This format may con- tain conversion specifiers ;the results from such conversions, if any, are stored through the pointer argu- ments. The scanf function reads input from the standard input stream stdin , fscanf reads input from the stream pointer stream ,and sscanf reads its input from the character string pointed to by str . The vfscanf function is analogous to vfprintf (3) and reads input from the stream pointer stream using a variable argument list of pointers (see stdarg (3). The vscanf function scans a variable argument list from the standard input and the vsscanf function scans it from a string; these are analogous to the vprintf and vsprintf functions respectively. Each successive pointer argument must correspond properly with each successive conversion specifier (but see ‘suppression’ below). All conversions are introduced by the % (percent sign) character .The format string may also contain other characters. White space (such as blanks, tabs, or newlines) in the format string match anyamount of white space, including none, in the input. Everything else matches only itself. Scanning stops when an input character does not match such a format character .Scanning also stops when an input conversion cannot be made (see below). CONVERSIONS Following the % character introducing a conversion there may be a number of flag characters, as follows: * Suppresses assignment. The conversion that follows occurs as usual, but no pointer is used; the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2009 for the course COMP 2510 taught by Professor A during the Spring '06 term at BC.

Page1 / 3

scanf - SCANF(3) Linux Programmer’s Manual SCANF(3) NAME...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online