#include <fstream> #include <string> bool touch(const std::string& file_path) { return std::ofstream(file_path, std::ios_base::app); } int main() { touch("foo.txt"); }
Standard input is empty
prog.cpp: In function 'bool touch(const string&)': prog.cpp:6:52: error: cannot convert 'std::ofstream {aka std::basic_ofstream<char>}' to 'bool' in return return std::ofstream(file_path, std::ios_base::app); ^
Standard output is empty