Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- warning: the use of `tmpnam' is dangerous, better use `mkstemp'
- char *tmpname = strdup("/tmp/tmpfileXXXXXX");
- ofstream f;
- int fd = mkstemp(tmpname);
- f.attach(fd);
- char *tmpname = strdup("/tmp/tmpfileXXXXXX");
- mkstemp(tmpname);
- ofstream f(tmpname);
- #include <stdlib.h>
- #include <fstream>
- #include <iostream>
- #include <vector>
- std::string open_temp(std::string path, std::ofstream& f) {
- path += "/XXXXXX";
- std::vector<char> dst_path(path.begin(), path.end());
- dst_path.push_back('