C programming vsscanf stdio.h

int vsscanf(const char * restrict s ,
 const char * restrict format,
 va_list arg);

s -This array stores the outputted data.

format -The string with the conversion specifier.

arg -A va_arg macro that consists of the variable names and whose input data is assigned to.

Return type
int -Returns the value of the macro EOF if an input failure occurs before any conversion.Otherwise, the ‘vsscanf’ function returns the number of input items assigned,which can be fewer than provided for,or even zero,in the event of an early matching failure.

In C programming the <stdio.h> vsscanf function is equivalent to sscanf function but instead of using ellipsis as the third argument it is replaced by va_list macro (found in <stdarg.h> header ).A code example is given below.

Link : C sscanf stdio.h

void func(char *s , char* format , …)
int ret;

va_list arg ;

va_start(arg , format);

ret=vsscanf(s ,format , arg);

printf(“\nret=%d” , ret);

va_end( arg );

int main( )
char s[20];

float f ;

int val ;

func( “Happy 190.409 1000” , “%s %f %d” , name , &f , &val);

printf(“\nName=%s \nf=%f \nval=%d”, name , f , val);

getchar( );
return 0 ;



‘ret’ gives the number of items assigned.And note while using ‘vsscanf’ all the conversion specifer rules still applies.For more information on conversion specifier rules visit the link C scanf stdio.h

Related links

->C vscanf

->C vfscanf

->C fscanf