RE: Get Key Function?



In a previous article, Jason Blevins <jrblevin@xxxxxxxxxxxxxxxx> wrote:
On May 1, 2009, at 12:41 PM, Jason Blevins wrote:
On May 1, 2009, at 10:51 AM, nuclear wingnut wrote:
I've been searching around the message board for information on a "Get
Key" function for Fortran - the ability to have a program read input
from a keyboard without having to push enter - and I've found a few
posts that explain the difficulty of this. However, the posts I could
find were at least a decade old, some older than that.

(snip)

If you don't mind using something non-standard, I know that
GFortran has an FGET extension for this. It's likely that
G95 has a similar extension.

My mistake. I just realized that FGET doesn't quite do what
you want. It just reads in stream mode, it won't get the
input for you immediately after a key press.

Jason

What I do in WATCOM FOrtran 77 (www.openwatcom.org)
is have a little "pragma" (short assembler program embedded
in the source) which looks at the keyboard strobe and gets
the keycode if there was a strobe. If it's a key I don't want,
I clear the strobe and return "no key".
But other fortrans don't have this ability. Too bad.
Chris
.



Relevant Pages

  • Fortran Version Question Apr. 8, 2009
    ... FORTRAN VERSION QUESTION ... Information is being sought regarding versatile, free download Fortran compilers ... One of the steps in the effort involves getting procedures established that would enable them to use different language computer programs to work on the same project. ... --- The ability to accept input using a standard type input command involving pressing the Enter key after typing in the data, and the ability to check for keyboard key presses with something like a GetKey command. ...
    (comp.lang.fortran)
  • Re: crash report
    ... Fortran code. ... INPUT_UNIT and OUTPUT_UNIT (what you call the keyboard and screen, ... Mind you, the very first compilers didn't, but all mine ...
    (comp.lang.fortran)
  • Re: Basic question on local variable
    ... Yes, as far as I know Fortran never adopted that ability, and even if it did guarantee to pass a temporary, as far as I know you are still not allowed to modify it. ... Fortran compilers are allowed to optimize out the parenthesis in y = addten), ...
    (comp.lang.fortran)
  • Re: bash script and standard input
    ... > asks the user for input by keyboard four times; ... When working with fortran, I have always found it easier to have the ... program read any necessary input from a file rather than standard input ... and then use a script to modify the input file as necessary. ...
    (comp.os.linux.development.apps)
  • Re: Encapsulation
    ... of assemblies without the ability to have a "nested ... Fortran 77 codebases that have no encapsulation or high-level structure at ...
    (microsoft.public.dotnet.languages.csharp)