Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.8 KiB

  1. /***
  2. *feoferr.c - defines feof() and ferror()
  3. *
  4. * Copyright (c) 1989-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Defines feof() (test for end-of-file on a stream) and ferror() (test
  8. * for error on a stream).
  9. *
  10. *Revision History:
  11. * 03-13-89 GJF Module created
  12. * 03-27-89 GJF Moved to 386 tree
  13. * 02-15-90 GJF Fixed copyright
  14. * 03-16-90 GJF Made calling type _CALLTYPE1 and added #include
  15. * <cruntime.h>.
  16. * 10-02-90 GJF New-style function declarators.
  17. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  18. *
  19. *******************************************************************************/
  20. #include <cruntime.h>
  21. #include <stdio.h>
  22. /* remove macro definitions for feof() and ferror()
  23. */
  24. #undef feof
  25. #undef ferror
  26. /***
  27. *int feof(stream) - test for end-of-file on stream
  28. *
  29. *Purpose:
  30. * Tests whether or not the given stream is at end-of-file. Normally
  31. * feof() is a macro, but it must also be available as a true function
  32. * for ANSI.
  33. *
  34. *Entry:
  35. * FILE *stream - stream to test
  36. *
  37. *Exit:
  38. * returns nonzero (_IOEOF to be more precise) if and only if the stream
  39. * is at end-of-file
  40. *
  41. *Exceptions:
  42. *
  43. *******************************************************************************/
  44. int __cdecl feof (
  45. FILE *stream
  46. )
  47. {
  48. return( ((stream)->_flag & _IOEOF) );
  49. }
  50. /***
  51. *int ferror(stream) - test error indicator on stream
  52. *
  53. *Purpose:
  54. * Tests the error indicator for the given stream. Normally, feof() is
  55. * a macro, but it must also be available as a true function for ANSI.
  56. *
  57. *Entry:
  58. * FILE *stream - stream to test
  59. *
  60. *Exit:
  61. * returns nonzero (_IOERR to be more precise) if and only if the error
  62. * indicator for the stream is set.
  63. *
  64. *Exceptions:
  65. *
  66. *******************************************************************************/
  67. int __cdecl ferror (
  68. FILE *stream
  69. )
  70. {
  71. return( ((stream)->_flag & _IOERR) );
  72. }