![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2005
Posts: 12
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|