Rewrote _scanf. It does need some tests and improvements, but it's a more
standard version than before, and it does support the necessary functionality to support scanf functions for files. Added vfscanf, fscanf and vfscanf. git-svn-id: svn://svn.cc65.org/cc65/trunk@3301 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
39
libsrc/common/vfscanf.c
Normal file
39
libsrc/common/vfscanf.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* vfscanf.c
|
||||
*
|
||||
* Ullrich von Bassewitz (uz@cc65.org), 2004-11-26
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "_scanf.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
int __fastcall__ vfscanf (FILE* f, const char* format, va_list ap)
|
||||
/* Standard C function */
|
||||
{
|
||||
struct scanfdata d;
|
||||
|
||||
/* Initialize the data struct. We do only need the given file as user data,
|
||||
* since the get and ungetc are crafted so they match the standard fgetc
|
||||
* and ungetc functions.
|
||||
*/
|
||||
d.get = (getfunc) fgetc,
|
||||
d.unget = (ungetfunc) ungetc,
|
||||
d.data = f;
|
||||
|
||||
/* Call the internal function and return the result */
|
||||
return _scanf (&d, format, ap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user