Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

PAUSE statement is obsolete?

blueyedtam
Beginner
1,899 Views

I was wondering if it was replaced by anything that might be more useful.

The reason why -- I want to be able toexamine the console output window just before the program exits. If I don't put the PAUSE statement there, the window disappears before I have a chance to look at the printout....

I tried using STOP, but that doesn't work because the output disappears immediately.

A READ statement would do the job, but that seems to be kinda mickey-mouse.

So, was that replaced by anything else?

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,899 Views
PAUSE is indeed a deleted feature in Fortran 2003 but most compilers, including ours, still support it. The standard suggests writing to and then reading from standard output - for your purpose, a simple:

read (*,*)

will do the trick and is very common.
0 Kudos
g_f_thomas
Beginner
1,899 Views

If you debug your program then setting a breakpoint 'pauses'

Here's another way to pause without PAUSE:

call wait()

Subroutine wait()

implicit none

character(1) Key

write *, 'press any key to continue'

Key = GETCHARQQ()

end subroutine wait

Gerry

0 Kudos
Reply