![]() |
| ||
| Difference betn getch(),getche(),getchar() functions I would like to know what is the difference betn getchar(),getch(), and getche() functions and which should be used in which conditions. Thanks, comwizz. :confused: |
| ||
| Re: Difference betn getch(),getche(),getchar() functions getcharThis is a standard function that gets a character from the stdin. getchThis is a nonstandard function that gets a character from keyboard, does not echo to screen. getcheThis is a nonstandard function that gets a character from the keyboard, echoes to screen. Use getchar if you want it to work on all compilers. Use getch or getche on a system that supports it when you want keyboard input without pressing [Enter].And note that the return value of all three is int! You need this to properly check for EOF. |
| ||
| Re: Difference betn getch(),getche(),getchar() functions Thanks for the reply :) |
| ||
| Re: Difference betn getch(),getche(),getchar() functions wat is echo?? |
| ||
| Re: Difference betn getch(),getche(),getchar() functions >wat is echo?? In this case, echo means that when you type a character, it prints to the screen so you can see what you typed. |
| ||
| Re: Difference betn getch(),getche(),getchar() functions Quote:
|
| ||
| Re: Difference betn getch(),getche(),getchar() functions getch() returns the character you typed without displaying it on the screen. getche() returns the character you typed by displaying(echoing) it on the screen. and finally, getchar() works similarly and echos the character that u typed on the screen after "enter" is given. hope you understood!! all the best !! :) Quote:
|
| ||
| Re: Difference betn getch(),getche(),getchar() functions Rocky2008> hope you understood!! What part of post #2 did you not understand? |
| ||
| Re: Difference betn getch(),getche(),getchar() functions Quote:
getch-just returns the character that had been typed without displaying on the screen. getchar-works similar as getche but needs an ENTER followed by the char typed...(macro version) |
| ||
| Re: Difference betn getch(),getche(),getchar() functions Quote:
People! this thread has been answered since post number two. And the only thing it could be added to it might be that unless you have a compelling reason to handicap your code with none standard functions, do not use getche() or getche(). |
| All times are GMT -4. The time now is 10:59 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC