Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 10th, 2005, 8:24 AM   #1
seymorebutts
Newbie
 
Join Date: Jul 2005
Posts: 12
Rep Power: 0 seymorebutts is on a distinguished road
i need help!

i've been reading many guides, and im kinda stuck in the part where it talks about getchar() and getche(). Can you tell me what they are, the difference?
ty
seymorebutts is offline   Reply With Quote
Old Jul 10th, 2005, 9:29 AM   #2
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
I believe (it has been a while) :

getchar - <stdio.h>, or better <cstdio> - returns the next character on the input stream stdin. This function [or macro] does not return immediately. The user can enter several characters before hitting return, at which time the first character entered is returned as an integer representing this character in the character-set.

getch - <conio.h> - returns the next character on the given input stream as the integer value representing the character in the character-set and increments the stream's file pointer to point to the next character. The function returns immediately and does not ECHO to the console, so it is often used for password checking.

getche - <conio.h> - is the same as getc except that the entered character is echoed in the console.

Nothing beats testing! But be aware that getche() and getch (<conio.h>) are non-standard.
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Jul 10th, 2005, 9:51 AM   #3
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
conio.h is a borland-only thing is it not? Along with graphics.h. I think you can find it as an external library for Dev-C++ and other compilers somewhere or other 'tho..

seymorebutts: Please use a descriptive title. Nothing is more annoything than reading "I need help!!!" "HELP ME PLZ!", etc. Many people will just not read your post otherwise.
Cerulean is offline   Reply With Quote
Old Jul 10th, 2005, 11:10 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Conio.h is also provided with Dev-C++ but it has been stripped considerably in the later versions. If you're on a Windows platform you can get improved functionality of the same sort by using the console part of the API. From the viewpoint of special keys it's even better. Understand that C/C++ has no standard library for things that are hardware dependent -- they work through dependent drivers via the auspices of the compiler and its layers of access, for reasons of portability.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:10 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC