mardi 8 janvier 2019

Could C++ on repl.it create new file?

I tried to create file on repl.it with C++:
(inside the main function)

std::ofstream file;
file.open("./output/test.txt", std::ofstream::out);

if (file.is_open())
{
    file << "Hello\nWorld!";
    file.close();
}

If the directory has a pre-made file then the app will open it and over-write the file, otherwise it keeps saying std::cout << file.is_open() is true. Is this a website feature or is it a bug?

Aucun commentaire:

Enregistrer un commentaire