Quote:Original post by JavaMavaQuote:Original post by Jan-Lieuwe
Your windows would only disappear if the CPU executes one of those 'exit(1)' statements. Those are executed when your program doesn't find 'input.txt' or when it cannot generate 'output.txt' (the latter being unlikely). Is 'input.txt' in the same folder as your executable?
All C / C++ projects would generate an .exe file, btw. So I don't understand what you're referring to when you say: "Why is it making an .exe as my other programs never have." - unless your previous projects were written using a different language.
I guess it muse be one of the exit commands, I'll go try that. It does find input.txt though as when I run the .exe it takes the text inside the input.txt and displays it on screen. Yes input.txt is in the same folder.
As for the confusion around generating .exe files, that must be my own mistake. We use a text based network, phobos, in my college so I never really see all my files unless I'm specifically looking for them. I guess when I'm at my home PC I just never noticed the .exe.
Ah, what system are you working on? I was sort of assuming you were creating a console application using Visual C++ on a Windows machine. system("pause"); isn't very portable!
If you see the output, then input.txt definitely can be found and the output.txt file can be generated. So it's not executing one of the exit calls then.
Another thing I used to use:
/* include this */#include <conio.h>/* use this to wait for a key */while (!kbhit()){ /* waiting for key... */}
(but I don't think that's part of the ANSI C standard either... getch() is another option)
Edit: just saw your edit. Glad you figured it out!