Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>cscanf() read formatted data from console</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 cscanf()                Read Formatted Data from Console

 #include <conio.h>

 int        cscanf(format-string[,argument...]);
 char       *format-string;              Format control string

    cscanf() uses getche() to read characters from the console and stores
    the data read in the locations given by 'argument'.

    cscanf() uses the same format-string and arguments as the scanf()
    function.  Both format-string and arguments are explained in detail
    in the description of scanf().


    Returns:    The number of fields converted and assigned with success.
                If a field was read but was not assigned, it is not
                counted.  If the return value is EOF, an attempt was made
                to read at the end of the file. If 0 is returned, no
                fields were assigned.

 Portability:   Applies to MS DOS only.

 ------------------------------ Example --------------------------------

    The following statements print a prompt, wait for input in the form
    of two strings, and verify the input by printing out the contents of
    the strings.

           #include <conio.h>

           int result;
           char buffer1[15], buffer2[15];

           main()
           {
               cprintf("Enter your name:");
               result = cscanf("%15s %15s",buffer1, buffer2);
               cprintf("\nEntered: %s, %s\n",buffer2, buffer1);
           }


See Also: fscanf() scanf() sscanf()

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