temporary file in C++

From: Scott (scott_at_nospam.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 01:29:44 GMT

Hi All,

Is there a way of creating a temporary file in C++ (similar to the
tmpfile() in C)? I have a C++ object that streams output to an fstream,
and I would like that file to be temporary (i.e. deleted after it is
used). What the program is doing is writing data to a file, and then
converting that file to another file using functions in a shared library
(which only accepts an existing file for input). The first file is now
unnecessary, and I would like to delete it. Any suggestions or help would
be most appreciated.

Best,
Scott



Relevant Pages

  • Re: Problem executing tmpfile() in program on Vista
    ... Problem executing tmpfile() in program on Vista ... The tmpfile function creates a temporary file and returns ... If the program terminates ...
    (comp.compilers.lcc)
  • Question about tempfile.rb - Ruby vs C
    ... written in pure Ruby instead of using the tmpfile() ... anonymous temporary file in your Tempfile::TMPDIR ... If your $TMPDIR environment ...
    (comp.lang.ruby)
  • Re: Problem executing tmpfile() in program on Vista
    ... The tmpfile function creates a temporary file and returns ... in the root directory. ... tmpnam does not. ...
    (comp.compilers.lcc)
  • Re: How can I unlink/delete an open file in Windows?
    ... execution even if the program terminates abnormally. ... The tmpfile function creates a temporary binary file that is ... whether an open temporary file is ... I suspect the unlink follows the fopen (this is an old but common ...
    (comp.lang.c)
  • Re: _lseek (fd, 0, SEEK_SET) has been aborted
    ... // spawnChild() is some function ... Note that tmpfile() returns NULL if you don't have enough privileges. ... I had that problem with tmpfileon Vista. ... The tmpfile function creates a temporary file and returns a pointer to that stream. ...
    (microsoft.public.vc.language)