Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - freopen http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   freopen

   Usage
   #include <stdio.h>
   FILE *freopen(const char *name,const char *mode,FILE *fp);

   Description
   Closes  file  indicated  by  fp. Errors while  closing  the  file  are
   ignored. Open a new file and associate the stream fp with it. name and
   mode mean the same as in fopen.

   Example
   #include <stdio.h>
   FILE *fp;
   main()
   {
        fp = freopen("file.dat", "w+", stdout);
        if(fp == NULL)
             fprintf(stderr,"error on freopen\n");
        else
             fprint(fp,"This data will go to file.dat\n");
   }

   Return Value
   freopen returns fp if successful, otherwise a NULL.


See Also: fclose fopen open

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson