getch () 
Author Message
 getch ()

I know that this news group discusses C, and not the extensions to it,
or the system-related queries related to it ..... but ....

I have searched high and low for an example code on how to get one
char at a time in c.  This program MUST run on SCO unix, which is NOT
a POIX complient system (as far as I know).

Can anybody help me ??

Thank-you.

Ian Barry



Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()

You mentioned this before I think.

Use a character array of only two characters (one for the null char). Get Get
your program to read ONLY the 1st character.

This is the best way to avoid the unbuffered input used by getch() and of
course remains ANSI compliant.

Single character input can then be read from the keyboard or other device. For
code e-mail.

ThE CoUnT



Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()


Quote:

>I know that this news group discusses C, and not the extensions to it,
>or the system-related queries related to it ..... but ....

>I have searched high and low for an example code on how to get one
>char at a time in c.  This program MUST run on SCO unix, which is NOT
>a POIX complient system (as far as I know).

It hasn't occured to you once to look into the source code of one of
the hundreds of freeware UNIX programs which gets character-at-a-time
input?

Quote:
>Can anybody help me ??

In this business, it's sink or swim! You have to be resourceful.


Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()

Quote:

>I know that this news group discusses C, and not the extensions to it,
>or the system-related queries related to it ..... but ....

>I have searched high and low for an example code on how to get one
>char at a time in c.  This program MUST run on SCO unix, which is NOT
>a POIX complient system (as far as I know).

Your "high and low" search didn't include the comp.lang.c FAQ, did it?
To read one character at a time in C, use getc(), or fgetc(), or fread()
with a count and size of 1, or if you're reading from stdin, you can use
getchar().  If you mean you want to read one character from the
terminal, unbuffered, and you can't find this information in the
comp.lang.c FAQ, you should go over to comp.unix.programmer or
comp.unix.sco.programmer, and ask them about tty modes.
Back when I was dealing with this sort of thing, on V7 Unix, it involved
stty() and CBREAK, but your mileage under SCO may vary.

--

Kenan Systems Corporation



Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()

: I know that this news group discusses C, and not the extensions to it,
: or the system-related queries related to it ..... but ....

: I have searched high and low for an example code on how to get one
: char at a time in c.  This program MUST run on SCO unix, which is NOT
: a POIX complient system (as far as I know).

: Can anybody help me ??

Well, if you've read the FAQ and that didn't help you'll have to ask
on a SCO-specific group.  If there's no such group, then the docs or
a local guru are your only hope.  (It's not entirely clear what you
want to do, and I'm afraid I don't know enough about SCO Unix to help).

Will



Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()

Quote:

> I know that this news group discusses C, and not the extensions to it,
> or the system-related queries related to it ..... but ....

....but you thought you were too good to follow the rules that everyone else
abides by?

Quote:
> This program MUST run on SCO unix,

Go ask on a SCO newsgroup!

firewind, who is an equal-opprotunity grumper, Michael.

--
(initiator of the campaign for grumpiness where grumpiness is due in c.l.c)

Attempting to write in a hybrid which can be compiled by either a C compiler
or a C++ compiler produces a compromise language which combines the drawbacks
of both with the advantages of neither.



Tue, 22 Aug 2000 03:00:00 GMT  
 getch ()

|I know that this news group discusses C, and not the extensions to it,
|or the system-related queries related to it ..... but ....
|
|I have searched high and low for an example code on how to get one
|char at a time in c.  This program MUST run on SCO unix, which is NOT
|a POIX complient system (as far as I know).
|
|Can anybody help me ??

Probably the folks at comp.unix.sco
Is that a surprise?



Wed, 23 Aug 2000 03:00:00 GMT  
 getch ()



Quote:
>I know that this news group discusses C, and not the extensions to it,
>or the system-related queries related to it ..... but ....

>I have searched high and low for an example code on how to get one
>char at a time in c.  This program MUST run on SCO unix, which is NOT
>a POIX complient system (as far as I know).

Recent and current versions of SCO Unix are POSIX.1 compliant (which is
what is relevant here) and support termios (man termios would have told
you that). Your extensive search apparently overlooked comp.unix.programmer
and comp.unix.sco.programmer.

--
-----------------------------------------


-----------------------------------------



Wed, 23 Aug 2000 03:00:00 GMT  
 getch ()


Quote:

>It hasn't occured to you once to look into the source code of one of
>the hundreds of freeware UNIX programs which gets character-at-a-time
>input?

Of course not!  That would be plagiarism.

-s
--

C/Unix wizard, Pro-commerce radical, Spam fighter.  Boycott Spamazon!
Not speaking for my employer.  Questions on C/Unix?  Send mail for help.
Visit my new ISP <URL:http://www.plethora.net/> --- More Net, Less Spam!



Sat, 26 Aug 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. getchar() != getch() : How to make a UNIX getch()???

2. (w)getch (ncurses)

3. getch() in C# ?

4. Avoiding the wicked getch()

5. getch on UNIX

6. getch vs getchar vs getc

7. getch() equivalent?

8. ANSI C getch() equivalent?

9. getch()

10. Keyboard input help: replacement for getch() - windows.h help

11. problems with getch()

12. getch()

 

 
Powered by phpBB® Forum Software