Cannot get file to open?

I am trying to get a simple html file to display but I cannot get the file to actually open. I have the file in the same place as my program files but it will not open. Is it a problem with my code or is it something else?

The file name is just "test"
Last edited on
> I have the file in the same place as my program files
http://www.gnu.org/software/libc/manual/html_node/File-Name-Resolution.html


Also, if the file is in an invalid state, I think that you need to inFile.clear(); before attempting anything.
I tried that, same result. The file name is "test"
The problem may be related to how you execute the application.
Paste the commands and user input.

Also, provide a directory listing to see that `test' file.
Have you tested it with other files?

edit: i just checked it and it works fine with the sample file i used.

albeit i had to add a cout/cin to check my results.. maybe you overlooked that?
Last edited on
I have tried it with multiple other text files but it's still not working?

Where does the .txt file need to be saved in order to open it?
> Where does the .txt file need to be saved in order to open it?
If you simply write `test', then the file ought to be in the current working directory.
Note that the `working directory' is not the same as the `directory where the executable is in'.
What is the difference between the `working directory' and the `directory where the executable is in'?
$ ls /usr
bin include lib local sbin share src
$ cd /usr
$ pwd
/usr
$ ls
bin include lib local sbin share src
$ /usr/bin/ls
bin include lib local sbin share src
$ bin/ls
bin include lib local sbin share src
`ls' resides in `/usr/bin/', however the runs refer to `/usr' because that's the current working directory (as showed by `pwd')
Last edited on
So you're saying my file is in the wrong place?

My .txt and .cpp files are saved in (C:/), and that is wrong?
Last edited on
My "test" file is saved in the same place as my ".cpp" source file but I'm still having issues. I have tried this on multiple computers as well.
I had same problems in past. My mistake was not adding .txt or .xl or whatever file I was trying to open. i.e. lets say your "test" file is a text document. so you need to enter input like this: test.txt
Topic archived. No new replies allowed.