-
Can not open file ( Qt )
Ok I have a file with constant name and want to open it.
I am using Qt framework and I am on Mac.
The path of my project is :
~Desktop/RayTracerFrameWorkOOP/
(here I have everything, header, source files and all the relevant files of Qt)
Here I have the file that I need to read from too. What I think is remarkable is that the file is of kind : Unix executable file
From Qt IDE I open the project from the recent projects option with this path :
~Desktop/RayTracerFrameWorkOOP/QImageViewer.pro
Here is the code
Code:
ifstream in("icosahedron_0.off");
if (!in) {
cout<<"\nError reading file."<<endl;
exit(0);
}
and when I execute the program I am receiving the Error reading file message.
Any ideas?
-
The real question is, where is your executable (the result of the build process) and where is your data file? Unless they're in the same directory or the data file is in the directory QtCreator uses as the working directory when you launch, it won't find it.
-
1 Attachment(s)
Great point! I wasn't aware of that.
When I execute I get this
Code:
/Users/usi/Downloads/QImageViewer-build-desktop-Qt_4_8_3__local__Release/QImageViewer.app/Contents/MacOS/QImageViewer exited with code 0
And so I went to the file and put the file into it ( Also the folder models has the file which I am interested in )
The image is taken in file QImageViewer-build-desktop-Qt_4_8_3__local__Release
Attachment 12296
-
Well, we were instructed to put the absolute path, because nobody could open it.