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

  1. /***
  2. *fgetc.c - get a character from a stream
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines fgetc() and getc() - read  a character from a stream
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <stdio.h>
  13. #include <dbgint.h>
  14. #include <file2.h>
  15. #include <internal.h>
  16. #include <mtdll.h>
  17.  
  18. /***
  19. *int fgetc(stream), getc(stream) - read a character from a stream
  20. *
  21. *Purpose:
  22. *       reads a character from the given stream
  23. *
  24. *Entry:
  25. *       FILE *stream - stream to read character from
  26. *
  27. *Exit:
  28. *       returns the character read
  29. *       returns EOF if at end of file or error occurred
  30. *
  31. *Exceptions:
  32. *
  33. *******************************************************************************/
  34.  
  35. int __cdecl fgetc (
  36.         REG1 FILE *stream
  37.         )
  38. {
  39.         int retval;
  40.  
  41.         _ASSERTE(stream != NULL);
  42.  
  43.         _lock_str(stream);
  44.         retval = _getc_lk(stream);
  45.         _unlock_str(stream);
  46.  
  47.         return(retval);
  48. }
  49.  
  50. #undef getc
  51.  
  52. int __cdecl getc (
  53.         FILE *stream
  54.         )
  55. {
  56.         return fgetc(stream);
  57. }
  58.