I'd like to create a temporary file stream. Is there a c++ equivalent to C's tmpfile() function.
If not, how would I create one?
I'd like to create a temporary file stream. Is there a c++ equivalent to C's tmpfile() function.
If not, how would I create one?
You could check whether your implementation offers a std::fstream constructor that takes a file descriptor, and if so use fileno to get the fd from the FILE* returned by tmpfile(). But the C++ standard doesn't guarantee that constructor.