dimanche 4 octobre 2020

Read Only File System with OfStream

I am trying to write to a file with ofstream in c++. It tells me that it is a "Read Only File System". I am able to make files outside of C++ -- i.e. other languages and with touch. Where path is "/home//file.textpb" in my case it is "/home/andrew/file.textpb".

std::ofstream file(path, std::ofstream::out);

if (file.fail()) {
  std::cerr << "Write Error: " << strerror(errno) << std::endl;
} else {
  file << "Some Text";

  file.close();
}

Aucun commentaire:

Enregistrer un commentaire