At 01:25 AM 12/27/2004 +0000, ed writeth:
>
>On Sat, 25 Dec 2004 14:53:27 +0530
>"Sankar R" <[EMAIL PROTECTED]> wrote:
>
>>          choice = getch();
>
>This is not ANSI C, fgets would be better, but I believe you still have
>to use the enter key to indicate end of input. getch is included in
>Linux but only under the Curses library, which is why I point this out.

To be the most cross-platform "compliant", getch() should be called in
cbreak mode under Linux.  getch() under most Windows compilers (if it
exists) typically only reads in one character at a time.  So, the enter key
is unnecessary.

All of that assumes that getch() is implemented without being buggy.
Borland skimped on the Console I/O sections for the Windows-specific part
of their compiler libraries, so things like clrscr() fail to fully clear
the display area of a console window.

To be ANSI standard, you will need to use fgetc(), fgets(), or fscanf().
All of those typically require hitting the enter key to process the data.
There is no standard way to get just one character from the keyboard.


Thomas J. Hruska
[EMAIL PROTECTED]

Shining Light Productions
Home of the Nuclear Vision scripting language and ProtoNova web server.
http://www.slproweb.com/



To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to