HP3000-L Archives

November 2001, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Barry Lake <[log in to unmask]>
Reply To:
Barry Lake <[log in to unmask]>
Date:
Fri, 9 Nov 2001 10:55:22 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (39 lines)
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 *

ATOM RSS1 RSS2