home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC.ZIP / FREOPEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.1 KB  |  42 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - freopen.c
  3.  *
  4.  * function(s)
  5.  *        freopen       - replaces a stream
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdio.h>
  18. #include <_stdio.h>
  19.  
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name            freopen -  replaces a stream
  24.  
  25. Usage           FILE *freopen(const char *filename, const char *type,
  26.                               FILE *stream);
  27.  
  28. Prototype in    stdio.h
  29.  
  30. Description     See description of fopen() in fopen.c
  31.  
  32. *---------------------------------------------------------------------*/
  33. FILE * _FARFUNC freopen(const char *filename, const char *type, FILE *fp)
  34. {
  35.         if (fp->token != (short) fp)
  36.                 return NULL;    /* validate pointer */
  37.  
  38.         fclose (fp);
  39.  
  40.         return __openfp (fp, filename, type, 0);
  41. }
  42.