Page 1 of 1

Can't fix problem with reading and writting to .txt files

Posted: Tue Oct 11, 2022 6:41 pm
by EmilySeville7cfg

Hi! Here is my code:

Code: Select all

#include <iostream>
#include <fstream>

int main () {
    std::ifstream input ("/home/emilyseville7cfg/Documents/work/C++/Tanya Shibko/Vases/Vases/input.txt");
    std::ofstream output ("/home/emilyseville7cfg/Documents/work/C++/Tanya Shibko/Vases/Vases/output.txt");
    return 0;
}

When I run it I obtain: /bin/bash: line 1: /home/emilyseville7cfg/Documents/work/C++/Tanya Shibko/Vases/build-Release/bin/Vases: No such file or directory error. I don't realize what should I do to fix it. Where to put my .txt files to read it in the most convenient manner in CodeLite?


Re: Can't fix problem with reading and writting to .txt files

Posted: Tue Oct 11, 2022 8:06 pm
by DavidGH

Hi,

Does it work if you remove the space in that filepath, or change it to one without a space? Or, if it's easier, create a space-free symlink to that path?

Regards,

David


Re: Can't fix problem with reading and writting to .txt files

Posted: Thu Oct 13, 2022 4:14 pm
by Jarod42

/home/emilyseville7cfg/Documents/work/C++/Tanya Shibko/Vases/build-Release/bin/Vases seems to be your executable.
Have you check the file is correctly generated (and at the correct place)?


Re: Can't fix problem with reading and writting to .txt files

Posted: Thu Oct 13, 2022 11:01 pm
by eranif

In general:

  • Try to avoid spaces in your folders
  • Always post the build log when posting such questions (it will make it a lot easier for us to help you)

Check my signature to see what information to provide
Eran