예제 #1
0
/*---------------------------------------------------------------------*

Name            scanf - gets formatted input from stdin

Usage           int scanf(const char *format[, argument ...])

Prototype in    stdio.h

Description     gets formatted input from stdin

Return value    number of fields scanned and stored.  scanf returns EOF
                if an attempt is made to read at end-of-file

*---------------------------------------------------------------------*/
int cdecl _FARFUNC scanf(const char *fmt, ...)
  {
  return( _scanner( (int near (*)(void *))_Nfgetc,
                    (void near (*)(int, void *))_Nungetc,
                    stdin,
                    fmt,
                   _va_ptr ) );
  }
예제 #2
0
int cdecl _FARFUNC vsscanf(const char *buf, const char *fmt, va_list ap)
{
        return  _scanner(
                (int near (*)(void *))Get,
                (void near (*)(int, void *))UnGet,
                &buf,
                fmt,
                ap
                );
}
예제 #3
0
/*---------------------------------------------------------------------*

Name            sscanf - gets formatted input from a string

Usage           int sscanf(const char *string,
                           const char *format[, argument ...])

Prototype in    stdio.h

Description     gets formatted input from a string

Return value    number of fields scanned and stored.  sscanf returns EOF
                if an attempt is made to read at end-of-string

*---------------------------------------------------------------------*/
int cdecl _FARFUNC sscanf(const char *buf, const char *fmt, ...)
{
        return  _scanner (
                (int near (*)(void *))Get,
                (void near (*)(int, void *))UnGet,
                &buf,
                fmt,
                _va_ptr
                );
}
/*--------------------------------------------------------------------------*

Name            cscanf - performs formatted input from console

Usage           int cscanf(char *format[,argument, ...]);

Prototype in    conio.h

Description     cscanf,  as  all  ...scanf  family  functions,  scans input
                fields,  one  character  at   a  time,  and  converts  them
                according to a given format; these functions all:

                . accept  a format  string  that  determines how  the input
                fields are  to be interpreted.

                . apply  the format  string to  a variable  number of input
                fields in order to format the input

                . store  the  formatted  input  in  the  addresses given as
                arguments  after  the  format  string.


Return value    cscanf  returns  the  number  of  input fields successfully
                scanned, converted  and stored. If cscanf  attempts to read
                an end-of-file, the return value  is EOF. If no fields were
                stored, the return value is 0.

*---------------------------------------------------------------------------*/
int cdecl cscanf (const char *fmt, ...)
{
        return  _scanner (
                (int near (*)(void *))_Ngetche,
                (void near (*)(int, void *))_Nungetch,
                NULL,
                fmt,
                _va_ptr
                );
}