Header File
stdio.h
Category
Console I/O Routines
Prototype
int vscanf(const char *format, va_list arglist);
Description
Scans and formats input from stdin.
vscanf might stop scanning a particular field before it reaches the normal end-of-field (whitespace) character, or it might terminate entirely, for a number of reasons. See scanf for a discussion of possible causes.
Return Value
vscanf returns the number of input fields successfully scanned, converted, and stored; the return value does not include scanned fields that were not stored. If no fields were stored, the return value is 0.
If vscanf attempts to read at end-of-file, the return value is EOF.
Example
#include <stdio.h> #include <stdarg.h> int vscnf(char *fmt, ...) { va_list argptr; int cnt; printf("Enter an integer, a float, and a string (e.g. i,f,s,)\n"); va_start(argptr, fmt); cnt = vscanf(fmt, argptr); va_end(argptr); return(cnt); } int main(void) { int inumber; float fnumber; char string[80]; vscnf("%d, %f, %s", &inumber, &fnumber, string); printf("%d %f %s\n", inumber, fnumber, string); return 0; }
Portability
POSIX |
Win32 |
ANSI C |
ANSI C++ |
|
+ |
+ |
+ |
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|