Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>tmpfile() create a temporary file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 tmpfile()               Create a Temporary File

 #include <stdio.h>

 FILE       *tmpfile(void);

    tmpfile() creates and opens a temporary file is "w+b" (binary
    read/write) mode.  The temporary file is automatically deleted when
    it's closed (using fclose()) or when the program terminates.

       Returns:     A pointer to the temporary file, if successful.  If
                    the file can't be created, NULL is returned.

   -------------------------------- Example ---------------------------------

           #include <stdio.h>

           main()
           {
               FILE *stream;
               char *buffr = "data to be entered";

               if ((stream = tmpfile()) != NULL) {
                   fprintf(stream,"%s",buffr);
                   printf("temp file opened & data entered");
                   fclose(stream);
               }
               else
                   perror("unable to open temp file\n");
           }


See Also: creat() fopen() mktemp() open() tmpnam()

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