LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-19-2004, 11:40 AM   #1
natm
Member
 
Registered: Sep 2004
Distribution: Ubuntu 7.04
Posts: 34

Rep: Reputation: 15
getch() in FC2


what header file do I #include to use getch() in g++?
 
Old 10-19-2004, 01:15 PM   #2
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
If you want unbuffered input you need to use a library that supports that (it's non-standard). For linux, the most common library for such things (and lots more related to the console) is the ncurses library. Install it if it's not installed already.
 
Old 10-20-2004, 01:10 PM   #3
natm
Member
 
Registered: Sep 2004
Distribution: Ubuntu 7.04
Posts: 34

Original Poster
Rep: Reputation: 15
ncurses is installed but when I try to use getch() it says stuff like "undefined function wgetch()" and will not compile.
 
Old 10-20-2004, 02:26 PM   #4
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
Well, as with all libs, you need to include certain headers files for declarations to be visible and you also need to link to certain libraries. On my system I #include <ncurses.h> and I pass this to the linker: -lncurses
Use google to locate a tutorial for ncurses, there are plenty.
 
  


Reply



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
Where is getch()....... rajsun Programming 2 03-28-2005 11:40 AM
getch function prasad514 Programming 6 01-03-2005 11:48 AM
Help with getch... darkarcon2015 Programming 4 09-12-2004 08:48 AM
how to get getch() working with c++ cool_ashwin22 Programming 3 08-03-2004 10:58 AM
getche() and getch() kamransoomro84 Programming 2 05-09-2004 12:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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