{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
SCANF(3) Linux Programmer’s Manual 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 any amount 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 result of the conversion is simply discarded.
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern