PDA

View Full Version : Command prompt automatically closes


W.E.T.
04-27-2004, 10:33 AM
Alrite,

I have a little question. I am using Fortran 77 within Salford. I have compiled it and have turned the program into an .exe, however like all exe's that run in the command prompt, the program runs and then the command prompt window closes after the program has finished. I want to run the .exe from a double click of the .exe and not run it witin the command prompt. I also know that u can change the cmd.exe to stay open, but I was just wondering it there is any way of closing the window from a single strike of the keyboard, without entering a character/integer/real following by return

Thanks

Nick

tzeis
04-27-2004, 06:18 PM
I can't really speak for what Salford does, but LF95 has a "pause" compiler option that keeps the console open after program termination. The console will close when the enter key is pressed.

W.E.T.
04-28-2004, 09:22 AM
I have tried writing pause in the source code and this is what I get when running:

***Pause:
Enter system command or press ENTER key to restart:

...this works fine but I was wondering if and how you could write your own message instead of the one above??? If it can be done in LF95, how do you do it

Thanks

tzeis
04-28-2004, 06:09 PM
The pause option I was referring to is actually a compiler option, which adds a similar function to the pause statement, but does not require modification of the source code.

To create your own message in source code is simple:


...
write(*,*) "My pause message here"
read(*,*)
end


Right before the program terminates write out the message you want to appear, and add a read statement with no input parameters. This is the functional equivalent of the pause statement.