Subject: | |
From: | |
Reply To: | |
Date: | Fri, 9 Nov 2001 10:55:22 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
At 10:40 -0800 11/9/01, John Burke wrote:
>Is there a pure c way to duplicate n = readx(ca, -1)? I.E., depressing any
>key terminates the read. I've tried getchar and scanf to no avail. Both seem
>to require a return to terminate the read.
Take a look at fgets().
From the HP C/iX Library Reference Manual:
Syntax
#include <stdio.h>
char *fgets (char *string, int n, FILE *stream);
Description
The fgets() function reads a string from an open stream. The string
parameter is a pointer to a character string, and stream is a file
pointer to the input stream
The fgets() function reads n-1 characters up to a newline character,
whichever comes first....
...
Sounds to me like if you used fgets() with n=2, then the read should
terminate after the first character. At least that's how I interpret it,
but I haven't actually tested it.
Barry Lake [log in to unmask]
Allegro Consultants, Inc. http://www.nospam.allegro.com
(408)252-2330
-------------
Remove ".nospam" to create valid address.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|