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

  1. /***
  2. *fputc.c - write a character to an output stream
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines fputc() - writes a character to a stream
  8. *       defines fputwc() - writes a wide character to a stream
  9. *
  10. *******************************************************************************/
  11.  
  12. #include <cruntime.h>
  13. #include <stdio.h>
  14. #include <dbgint.h>
  15. #include <file2.h>
  16. #include <internal.h>
  17. #include <mtdll.h>
  18.  
  19. /***
  20. *int fputc(ch, stream) - write a character to a stream
  21. *
  22. *Purpose:
  23. *       Writes a character to a stream.  Function version of putc().
  24. *
  25. *Entry:
  26. *       int ch - character to write
  27. *       FILE *stream - stream to write to
  28. *
  29. *Exit:
  30. *       returns the character if successful
  31. *       returns EOF if fails
  32. *
  33. *Exceptions:
  34. *
  35. *******************************************************************************/
  36.  
  37. int __cdecl fputc (
  38.         int ch,
  39.         FILE *str
  40.         )
  41. {
  42.         REG1 FILE *stream;
  43.         REG2 int retval;
  44.  
  45.         _ASSERTE(str != NULL);
  46.  
  47.         /* Init stream pointer */
  48.         stream = str;
  49.  
  50.         _lock_str(stream);
  51.         retval = _putc_lk(ch,stream);
  52.         _unlock_str(stream);
  53.  
  54.         return(retval);
  55. }
  56.  
  57. #undef putc
  58.  
  59. int __cdecl putc (
  60.         int ch,
  61.         FILE *str
  62.         )
  63. {
  64.         return fputc(ch, str);
  65. }
  66.