home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / fwscanf.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  66 lines

  1. /***
  2. *fwscanf.c - read formatted data from stream
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines fwscanf() - reads formatted data from stream
  8. *
  9. *******************************************************************************/
  10.  
  11.  
  12. #include <cruntime.h>
  13. #include <stdio.h>
  14. #include <wchar.h>
  15. #include <dbgint.h>
  16. #include <stdarg.h>
  17. #include <file2.h>
  18. #include <internal.h>
  19. #include <mtdll.h>
  20.  
  21. /***
  22. *int fwscanf(stream, format, ...) - read formatted data from stream
  23. *
  24. *Purpose:
  25. *       Reads formatted data from stream into arguments.  _input does the real
  26. *       work here.
  27. *
  28. *Entry:
  29. *       FILE *stream - stream to read data from
  30. *       wchar_t *format - format string
  31. *       followed by list of pointers to storage for the data read.  The number
  32. *       and type are controlled by the format string.
  33. *
  34. *Exit:
  35. *       returns number of fields read and assigned
  36. *
  37. *Exceptions:
  38. *
  39. *******************************************************************************/
  40.  
  41. int __cdecl fwscanf (
  42.         FILE *stream,
  43.         const wchar_t *format,
  44.         ...
  45.         )
  46. /*
  47.  * 'F'ile (stream) 'W'char_t 'SCAN', 'F'ormatted
  48.  */
  49. {
  50.         int retval;
  51.  
  52.         va_list arglist;
  53.  
  54.         va_start(arglist, format);
  55.  
  56.         _ASSERTE(stream != NULL);
  57.         _ASSERTE(format != NULL);
  58.  
  59.         _lock_str(stream);
  60.         retval = (_winput(stream,format,arglist));
  61.         _unlock_str(stream);
  62.  
  63.         return(retval);
  64. }
  65.  
  66.