Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Programming Question



On Fri, 7 Jun 1996, R T Dhami wrote:

> Hi,
> 
> I've been trying to accomplish this task:
> 
>       get a char (or int) from the keyboard without having to press
>       return after.  Every standard command like fgetc etc. all need
>       to have the return key pressed to continue.
> 

If I am correct (I am not sure), fgetc() is the unction needed, if you 
put it in a loop:

for (i = 0; i < 10; i++) {
    ch[i] = fgetc();

    if ch[i] = '\r' then {
        ch[i] = NULL;
        break;
    }
}

I think that is the best solution to getting a string with fgetc(), but 
you do need to press return after...

I am a little unsure though (I haven't used C for a while).

> Is there something I can use to do this with NetBSD-1.1?
> 
> Rick
> 
> ///
> //-------------------------------------------------------------------------
> /  Rick Dhami
>    Undergraduate, Department of Computer Science
>    University of Victoria
>    Victoria, BC, Canada
> 
>    rdhami%gulf.uvic.ca@localhost                                    
> rdhami%uvic.ca@localhost
>                                                   
>                    Web Page:  http://gulf.uvic.ca/~rdhami               /
> -------------------------------------------------------------------------//
>                                                                         ///
> 
> 


--------------------------------------------------------------------------------
"Rub yourself up with deep-heat      |      The Intel-Outside page
 and stand next to a radiator!"      |  http://www.brad.ac.uk/~laguest
--------------------------------------------------------------------------------
                             Ah! The asian child...
--------------------------------------------------------------------------------
          Whats your nightmare? Being inbetween Steph and Begbie!!!
--------------------------------------------------------------------------------




Home | Main Index | Thread Index | Old Index