Path: g2news2.google.com!news2.google.com!news.glorb.com!multikabel.net!newsfeed20.multikabel.net!goblin1!goblin3!goblin.stu.neva.ru!exi-transit.telstra.net!pit-in1.telstra.net!news.telstra.net!news-south.connect.com.au!bunyip2.cc.uq.edu.au!not-for-mail From: David Duffy Newsgroups: comp.lang.fortran Subject: Re: Get Key Function? Date: Mon, 4 May 2009 22:15:13 +0000 (UTC) Organization: University of Queensland Lines: 26 Message-ID: References: NNTP-Posting-Host: orpheus.qimr.edu.au X-Trace: air.soe.uq.edu.au 1241475313 17994 152.98.160.59 (4 May 2009 22:15:13 GMT) X-Complaints-To: news@uq.edu.au NNTP-Posting-Date: Mon, 4 May 2009 22:15:13 +0000 (UTC) User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.6.17-5mdv (i686)) nuclear.wing...@gmail.com 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. > Have there been any recent developments (or tricks) that would allow > for input that doesn't require pressing the return key? If it helps, > I'm using g95. Not recent, but the curses library reads the terminfo database to find out how to do this for your terminal and OS. There is an old shareware library (Fortran 77) fcurses, which among other things includes a demonstration popup calculator (reads function keys, numeric keypad etc). The curses library has: getch(3NCURSES) NAME getch, wgetch, mvgetch, mvwgetch, ungetch, has_key - get (or push back) characters from curses terminal so this could probably be called directly using the Fortran 2003 FFI. Cheers, David Duffy.