Code is not reading in input file

D
Last edited on
Perhaps your input file is in the wrong location. It needs to be in the current working directory, which can be different depending on how you're running the program. If you're running the program from inside an IDE then the input should probably be in the same directory as the project files. If you're running the program from the command line then the input file needs to be in the directory from which you're running the program.

I am running the program from the command line and the input file is in the same directory from which I am running the program. I also have the input file as part of my project resource files. I am still not able to open my input file and my program simply terminates.
When you say the program simply terminates, you mean it prints "Error Opening File" and that the program terminates with an exit code of 1, right?

What operating system are you using?

Have you issued either the "dir" or "ls -l" command from that directory to insure the file is actually in the directory?

Right, so my program prints "Error Opening File" and the program terminates with the exit code of 1.

I am using the windows operating system on my Mac via Parallels.

I have not issued either the "dir" or "ls -l". I haven't learned what those are and so I am not familiar with it.
Those are commands to list the directory contents. If you're running Windows you'll type "dir" then press enter and you should see a directory listing.

Topic archived. No new replies allowed.