7 Apr 2002 17:57
Re: a little help for newbie in C
Elias Athanasopoulos <eathan <at> otenet.gr>
2002-04-07 15:57:42 GMT
2002-04-07 15:57:42 GMT
On Sat, Apr 06, 2002 at 11:38:28AM -0500, ramzez wrote:
> I'm newbie in C and I want to write a string and later read a char... but i
> don't want to see this char (I mean don't echo only for this)...
> <.../...>
> printf("Hi, i am a string\n")
> key=getchar(); //but I don't want to see the character pressed
> <.../...>
There are a lot of ways to do this. Some of them are more or less porta-
ble.
One way is to use the ncurses lib. It contains a lot of functions for
text mode applications (text windows, keyboard handling, etc.). Read
the ncurses docs to see examples.
One other is to use low-level terminal handling. I did this before
3-4 years. Below, you can have a look at my code. It's quite old so
double-check it.
Elias
#include <stddef.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
struct termios saved_attrib;
(Continue reading)
Thanks for your time.
anna
RSS Feed