====== vfscanf ====== int vfscanf ( FILE * stream, const char * format, va_list arg ); ==== description of vfscanf ==== The vscanf(), vfscanf(), and vsscanf() functions shall be equivalent to the scanf(), fscanf(), and sscanf() functions, respectively, except that instead of being called with a variable number of arguments, they are called with an argument list as defined in the header. These functions shall not invoke the va_end macro. As these functions invoke the va_arg macro, the value of ap after the return is unspecified. #include #include #include FILE *fp; int my_vfscanf(char *fmt, ...) { va_list argptr; int cnt; va_start(argptr, fmt); cnt = vfscanf(fp, fmt, argptr); va_end(argptr); return(cnt); } int main(void) { int inumber = 6; float fnumber = 7.0; char string[30] = "hoopy frood"; fp = tmpfile(); if (fp == NULL) { perror("tmpfile() call"); exit(1); } fprintf(fp,"%d %f %s\n",inumber,fnumber,string); rewind(fp); my_vfscanf("%d %f %s", &inumber, &fnumber, string); printf("%d * %f = %s\n", inumber, fnumber, string); fclose(fp); return 0; } ===== output of vfscanf c example ===== 6 * 7.000000 = hoopy