If the tmp directory already exists, this should be reasonably trivial.
1 2 3 4 5 6 7 8 9
#include <fstream>
int main(int argc, constchar* argv[])
{
std::ofstream os("tmp/somefile.txt");
os << "Bleh";
return 0;
}
If the directory doesn't exist, it's a little more fiddly as there's no standard way of creating directories - your best bet is to call into the OS APIs to do so.
It is not clear to me at all how to do any of this. For example, even if I know how to create a temporary file, how do I then transfer that temporary file back to somewhere in my home directory? How can I specify a particular path name to which the file should be transfered afterward?