atom-gpp-compiler
atom-gpp-compiler copied to clipboard
Cannot compile and run when there is a .txt input file to be read from.
Hello everyone! Im going to jump right into the issue for those that want to skip all of my explaining.
Atom-gpp-compiler works does not work when the program being compiled involves file input.
I really need some help figuring this issue out. It's quite literally been weeks that I have been navigating errors with atom-gpp-compiler. I absolutely LOVE atom and would love to finally be able to run bits of code within the app.
Now I finally got gpp-compiler to work after fixing my stupid mistake of not adding the extension .cpp or .c to my files. MOST of my programs now run within atom (by opening the terminal) flawlessly.
Except for programs that are required to read from an input file. I have checked thoroughly that I am not making a simple or inattentive error. My input.txt file is in the same folder that my .cpp program is in.
My program is supposed to input from a text file and process data from it. This works flawlessly in my IDE, CodeRunner (highly recommended IDE for beginners btw), but not within atom.
When terminal opens up to begin compiling, it stops at the point where it is supposed to read my input .txt file (or so I believe). I will attach the text within my terminal below.
username@######s-MacBook-Pro ~ % /var/folders/6t/xmvy2qk97n73w3fx56f98bmc0000gn/T/Lab\ 8\ Option\ 1TEST ; exit;
Cannot open file. Terminating program.
sh: pause: command not found
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
What is interesting, is that I am not being given the error message that I coded into the program, to appear should the file be unavailable/in-use. This thought is just coming to me now that I have finished typing this out. If the program was running perfectly, and if the only issue was that the lab8inp.txt
file was unable to be read for some reason, then shouldn't
cout << "Cannot open file. Terminating program." << endl;
be output after compilation?
And here is a snippet of the code for reference, regarding the input file. I don't know if it's necessary to help fix the problem but maybe it will help visualize what I mean by "input file". Like I said before, the program works wonderfully in CodeRunner. I am a beginner so I don't know what information is best to present, and what is overkill when requesting help with troubleshooting.
void openFiles() {
//Open data file.
inData.open("lab8inp.txt");
//Checking for error opening data file.
if (!inData) {
cout << "Cannot open file. Terminating program." << endl;
system("pause");
exit (1)
Thank you all for taking the time to help a student in need! I appreciate it. Atom.io rocks