Re: Press any key to continue?



Bamm wrote:
Sorry if this is a stupid question, but how do you do a "Press any key
to continue"? PAUSE will require you to type "go" while READ *
requires that you press the Enter key.
Why not just "Press RETURN to continue" ?

Because I'm working on a homework which we are supposed to translate a
program from QBX (Microsoft QuickBasic PDS 7.1) to g77. I couldn't
find a fortran equivalent for the following line:

Do Until Len(Inkey$): Loop

It doesn't have to be a direct equivalent in code, but it should work
the same way. :)

I think you might be able to use the getchar() function from the C library.


print *,'Press any key to continue...'
call getchar()
print *, 'Done'
end

You will need to compile with a special option, i.e.
g77 -fno-underscoring whatever.f
.