Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Programming/Code/Standard C Library/Functions/vscanf, vfscanf, and vsscanf

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

vscanf, vfscanf, and vsscanf #include <cstdarg> #include <cstdio> int vscanf( const char *format, va_list arg_ptr ); int vfscanf( FILE *stream, const char *format, va_list arg_ptr ); int vsscanf( const char *buffer, const char *format, va_list arg_ptr ); These functions are not supported on all libraries. These functions are very much like scanf(), fscanf(), and sscanf(). The difference is that the argument list is a pointer to a list of arguments. va_list is defined in cstdarg, and is also used by (Other Standard C Functions) va_arg(). For example: void error( char *fmt, ... ) { va_list args; va_start( args, fmt ); fprintf( stderr, "Error: " ); vfprintf( stderr, fmt, args ); fprintf( stderr, "\n" ); va_end( args ); exit( 1 ); }