How to create a std::ofstream to a temp file?

I’ve done this function: #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(‘\0’); int fd = mkstemp(&dst_path[0]); if(fd != -1) { path.assign(dst_path.begin(), dst_path.end() – 1); f.open(path.c_str(), std::ios_base::trunc | std::ios_base::out); close(fd); } return path; } int main() { std::ofstream logfile; open_temp(“/tmp”, logfile); if(logfile.is_open()) { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)