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

General questions regarding the usage of CodeLite
User avatar
EmilySeville7cfg
CodeLite Curious
Posts: 1
Joined: Mon Oct 03, 2022 5:11 pm
Genuine User: Yes
IDE Question: C++
Location: Canada, Toronto
Contact:

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

Post 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?

DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

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

Post 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

User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

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

Post 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)?

User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post 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

Make sure you have read the HOW TO POST thread
Post Reply