/*-------------------------------------------
| Name:scanf
| Description:
| Parameters:
| Return Type:
| Comments:
| See:
---------------------------------------------*/
int __scanf(const char * fmt, ...){
   va_list ptr;
   int rv;
   va_strt(ptr, fmt);
   rv = __vfscanf(stdin,(char *)fmt,ptr);
   va_end(ptr);
   return rv;
}
/*-------------------------------------------
| Name:fscanf
| Description:
| Parameters:
| Return Type:
| Comments:
| See:
---------------------------------------------*/
int __fscanf(FILE * fp, const char * fmt, ...)
{
   va_list ptr;
   int rv;
   va_strt(ptr, fmt);
   rv = __vfscanf(fp,(char *)fmt,ptr);
   va_end(ptr);
   return rv;
}
예제 #3
0
파일: fscanf.c 프로젝트: changloong/msvcrt
/*
 * @implemented
 */
int fscanf(FILE *stream,const char *format, ...)
{
  va_list arg;
  int done;

  va_start(arg, format);
  done = __vfscanf(stream, format, arg);
  va_end(arg);

  return done;
}
/*-------------------------------------------
| Name:vsscanf
| Description:
| Parameters:
| Return Type:
| Comments:
| See:
---------------------------------------------*/
int __vsscanf(char * sp,const char *fmt, va_list ap)
{
   int rv;
   FILE string[1] =
   {
      {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
       _IOFBF | __MODE_READ}
   };

   string->bufpos = sp;
   rv = __vfscanf(string,(char *)fmt,ap);
   return rv;
}
/*-------------------------------------------
| Name:sscanf
| Description:
| Parameters:
| Return Type:
| Comments:
| See:
---------------------------------------------*/
int __sscanf(const char * sp, const char * fmt, ...)
{
   FILE string[1] =
   {
      {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
       _IOFBF | __MODE_READ}
   };

   //thread safe (stdio string mutex)
   va_list ptr;
   int rv;
   va_strt(ptr, fmt);
   string->bufpos = (char*)sp;
   rv = __vfscanf(string,(char *)fmt,ptr);
   va_end(ptr);

   return rv;
}
예제 #6
0
파일: fscanf.c 프로젝트: changloong/msvcrt
/*
 * @implemented
 */
int
fwscanf(FILE *stream, const wchar_t *fmt, ...)
{
  va_list arg;
  int done;
  char *cf;
  int i,len = wcslen(fmt);

  cf = malloc(len+1);
  for(i=0;i<len;i++)
    cf[i] = fmt[i];
  cf[i] = 0;

  va_start(arg, fmt);
  done = __vfscanf(stream, cf, arg);
  va_end(arg);
  free(cf);
  return done;
}
예제 #7
0
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.  */

#include <ansidecl.h>
#include <stdarg.h>
#include <stdio.h>


/* Read formatted input from STREAM according to the format string FORMAT.  */
/* VARARGS2 */
int
DEFUN(fscanf, (stream, format),
      FILE *stream AND CONST char *format DOTS)
{
  va_list arg;
  int done;

  va_start(arg, format);
  done = __vfscanf(stream, format, arg);
  va_end(arg);

  return done;
}
/*-------------------------------------------
| Name:vscanf
| Description:
| Parameters:
| Return Type:
| Comments:
| See:
---------------------------------------------*/
int __vscanf(const char *fmt,va_list ap){
   return __vfscanf(stdin,(char *)fmt,ap);
}