fork(2) download
  1. #include <fstream>
  2. #include <string>
  3.  
  4. bool touch(const std::string& file_path)
  5. {
  6. return std::ofstream(file_path, std::ios_base::app);
  7. }
  8.  
  9. int main()
  10. {
  11. touch("foo.txt");
  12. }
  13.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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);
                                                    ^
stdout
Standard output is empty