PDA

View Full Version : file not found... and a... well... newbie solution...



qtDave
12th November 2009, 18:36
Hi,

I just want to share this...

Have been breaking my head on the reading of a simple ascii file...

Prgram kept not reading anything. Using "qDebug() <<..." all I got was file not found. The file WAS in the same directory as the sources...

I looked for it during 2 nights. I searched the forum here, but "file not found" is rendered in "file -found" as search query, so that doesn't give what you're looking for.

Then, during a short moment of enlightment, I copied the file ("a.txt") to the debug directory (where the exe file is found) and tadaaa! The debug window spit out all of the information that I was hoping to see...

greatness... :o

spirit
12th November 2009, 19:04
it's nothing special. debug dir it is work dir, because exe-file is located in that dir.
the dir where are your sources located, is project dir.

squidge
12th November 2009, 19:05
Been there, done that :) Maybe not for quite as long as you have, but it still had me head butting the table :D

What makes it event worse is that under QtCreator, the programs working directory at runtime is the "Debug" or "Release" folder, whilst when running under Visual Studio (my other dev environment) it isn't. If you go into the Debug or Release folder with your file manager and run the exe yourself, then that dir is your working dir, but if you run it from the IDE, then the project dir (the dir with all your sources is) is your programs working dir.

Grrr... Why does everyone do it differently!