|
From: Brian M. <str...@ho...> - 2002-03-22 21:37:18
|
To use getch() properly, you must have cout << endl; be the last statement
you make before using getch(). Otherwise it will either wait for an
endline, or it will output everything after the last
cout << endl; statement AFTER the user presses a key.
Ex:
void main() {
cout << "Daniel" << endl;
getch();
}
displays "Daniel", advances to next line, then waits for user to strike a
key.
void main() {
cout << "Daniel";
getch();
}
presents user with a blank console and waits for user to press any key
before displaying "Daniel".
void main() {
cout << "Daniel" << endl << "Bob";
getch();
}
displays "Daniel", advances to next line, waits for user to press a key,
then displays "Bob" (does not display the character pressed by the user).
>From: "Daniel Wilches" <d_w...@ho...>
>To: dev...@li...
>Subject: [Dev-C++] Getch()? How???
>Date: Thu, 21 Mar 2002 12:51:52 -0500
>
>
>
>How to capture only a keystroke from the keyboard?? getch(), getchar() and
>getche() doesnt seem to work how they should... This is what im doing::
>
>#include<iostream>
>#include<conio.h>
>void main()
>{
>cout<<"Daniel";
>getch();
>}
>
>and i add in further objects to be searched in the project options this:
>C:\Dev-c++\lib\conio.o
>
>The getch in this program continue reading keystroke until it finds a
>Return, but what i want is only to read a keystroke...
>
>Please, anybody can help me??
>
>ThanXX
>Daniel Wilches
>
>_________________________________________________________________
>Hable con sus amigos en línea, pruebe MSN Messenger:
>http://messenger.msn.es
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Join the worlds largest e-mail service with MSN Hotmail.
http://www.hotmail.com
|