Author Topic: codeblocks no more lets me open files using fstream  (Read 9770 times)

Offline mIRChele

  • Single posting newcomer
  • *
  • Posts: 2
codeblocks no more lets me open files using fstream
« on: May 30, 2013, 10:15:29 pm »
Hi, I began to start programming in C++ (using Code::Blocks) since 5 months. I use it both with Windows and Linux (mostly this one).

Today I encountered a problem: when I compile a program which uses other files from the directory using fstream (for example, it takes a text file from the program folder and then prints it on the screen) and I use the run option embedded in Code::Blocks, it doesn't work properly: if I choose to import a file from there, nothing happens (but the program acts as a file is in there, even if I delete this file, because I've put an error message if no files are found). Otherwise, if I choose to start the program from the terminal, it works perfectly.

Now, I'm pretty sure this didn't happened in the previous days (I'm not drunk, I assure you!), but the most strange thing is that I'm having this issue both on Windows and Linux!  ???

What's happening there? Is my PC possessed? Or I'm just becoming mad?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: codeblocks no more lets me open files using fstream
« Reply #1 on: May 31, 2013, 01:19:38 am »
Code?
have you checked Project->Properties->Build Targets->Execution Working dir (there should be the files, so your files shouldn't be in the bin folder, but in the project folder)

Offline mIRChele

  • Single posting newcomer
  • *
  • Posts: 2
Re: codeblocks no more lets me open files using fstream
« Reply #2 on: May 31, 2013, 11:11:21 am »
yeah i discovered that since yesterday it started to read files from the project folder, and not in bin/debug (or bin/release)... very strange it started now to work like this, but what's important is that now i can test it! thank you