Okay, mkstemp is the preferred way to create a temp file in POSIX.
mkstemp
But it opens the file and returns an int, which is a file descriptor. F
int
Maybe this will work:
char tmpname[256]; ofstream f; sprintf (tmpname, "/tmp/tmpfileXXXXXX"); int fd = mkstemp(tmpname); ofstream f(tmpname);
I haven't tried it, but you can check.