Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-21-2002, 10:46 AM   #1
Registered: Nov 2002
Distribution: Mandrake 9.0
Posts: 58

Rep: Reputation: 15
Unhappy getchar() 's odd behavior

I don't know if this is the right forum to post in, but this is probably a simple question. I've just started writing C programs, using the gcc compiler. However, my manual refers to a function called "getche()" that receives input from the keyboard without printing it on the screen and forcing you to press enter. It says this is a non-standard function, and you have to include the file "conio.h" to use it. I assume gcc doesn't have that file. All I really want to do is use non-line-buffered input in my program. Is there a way to do that? Better yet, is there a place where I could read about the functions included with gcc and get to know them better?
Old 12-21-2002, 12:33 PM   #2
Registered: May 2002
Location: Jaipur
Distribution: muLinux
Posts: 58

Rep: Reputation: 15
curses.h to the rescue.
curses.h is good for console based apps made in c.
personally I CURSE IT %$@#^@.

Try the gcc website
or <-better
try $info gcc.
(I am not sure about contents of any of these)
Old 12-21-2002, 02:50 PM   #3
LQ Newbie
Registered: Nov 2002
Posts: 3

Rep: Reputation: 0
Thanks! The Curses library was right in my /include directory, and the website you mentioned has a lot of info on using it.
Old 12-22-2002, 12:29 PM   #4
Registered: May 2002
Location: Jaipur
Distribution: muLinux
Posts: 58

Rep: Reputation: 15
It striked me all of sudden that I made a mistake when I told you to use curses.h

Its like using a gun to shoot a bee.
curses.h is 'a bit' high on the learning curve and is not ment to be an addition to a console based program.

It is a different approch.With curses.h U do not write a program and include curses.h into your program. Instead U write a curses based program and then add the functionality that U wanted. Its not to be used unless U want a user freindly console like GUI program. Curse does add a lot of power to Ur console app like mouse clicks(even triple clicks and scrolling) but in Ur case curses wont replace getche().First U replace the entire code to make it curse freindly and then add Ur orignal code. I recomend U look elswhere.

Besides people do not make console based apps anymore. For the time one devotes to learning curses he is better of utilizing it to learn Qt instead and make some KDE based apps.

Last edited by yadavankur; 12-26-2002 at 03:20 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd Knoppix behavior Darkstar Linux - Distributions 1 06-25-2005 09:46 PM
Odd CD behavior in installation MockieMoo Slackware - Installation 1 05-14-2004 10:28 PM
Odd Re-Booting Behavior ....... ? justaguynsrq Slackware 2 04-16-2004 12:02 PM
postgresql odd behavior doublefailure Linux - Software 1 08-28-2002 12:40 AM
RH 6.2 ... odd behavior jubal Linux - Networking 3 02-27-2001 09:04 AM

All times are GMT -5. The time now is 08:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration