Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>sscanf</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
sscanf

Usage

   #include <stdio.h>
   int sscanf(char *buffer,const char *format,...);

   ANSI

Description

   sscanf is a formatted input routine which  reads from the specified
   buffer using the specified format. The additional arguments must be
   pointers to where the values are to be stored.

   For details of the format and usage refer to the entry for fscanf.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   char *string = "1.24...";
   char str[8];

   float fp;
   int i;

   int main()
   {
       sscanf(string,"%s",str);
       sscanf(string,"%f",&fp);
       sscanf(string,"%d",&i);
       printf("String : %s\n",str);
       printf("Float : %f\n",fp);
       printf("Integer: %d\n",i);
       return EXIT_SUCCESS;
   }

Return Value

   The number of assigned input items excluding any assignment suppressed
   conversions is returned. If the end of file is encountered before any
   assignments are done or before any conflicts occur, an EOF is returned.
   sscanf() normally returns when it reaches the end of the format string.


See Also

   printf fscanf scanf fscanf


See Also: printf fscanf scanf fscanf

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson