User Tools

Site Tools


c:stdio.h:vfscanf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:stdio.h:vfscanf [2013/02/25 16:08]
158.181.88.241 added prototype
c:stdio.h:vfscanf [2024/02/16 01:05] (current)
Line 5: Line 5:
  
 ==== description of vfscanf ==== ==== description of vfscanf ====
-vfscanf is in work by code-reference.com \\  +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 <stdarg.h> headerThese functions shall not invoke the va_end macroAs these functions invoke the va_arg macro, the value of ap after the return is unspecified.
-if you are faster... don't hasitate and add it+
  
 <code c> <code c>
-no example at the moment+#include <stdio.h> 
 +#include <stdlib.h> 
 +#include <stdarg.h> 
 + 
 +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; 
 +
 </code> </code>
  
 ===== output of vfscanf c example ===== ===== output of vfscanf c example =====
-    no example at the moment +    6 * 7.000000 = hoopy

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdio.h/vfscanf.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz