Posted by Joey *DClub* on August 15, 2004
In Reply to: Re: Locating keypress posted by DelphiLand Team on August 14, 2004
: : Heya... i known this forum is for GUI but i was wondering if i could ask a quick question about console applications...
: : How can i capture a key press?? As in... if the user presses the 'J' key then i can mask it with a '*' after adding it to a variable.
: : Thanks, Joey ^__^
: : P.S. How come my numbers come up after my name and *DClub* like other people??
: In a console application, Read(var) waits for the user typing a character on the keyboard. So you can code it as follows:
: On the other hand, ReadLn(var) waits for the user typing a string and ending it with "ENTER", so for VAR you use a string variable. Example:
: PS: From time to time, we process the forum messages and we replace the membership-id's with *DClub*, meaning "DelphiLand Club" :)
Thanks very much!! i thort Read() waited for the user to press enter aswell and then discarded the #13#10 from the line so a new line wasnt created :) now i understand the difference between Read and ReadLn more than i did :)
Thanks, Joey ^__^
Compiling Console Applications|
Learn Pascal with simple Delphi Console Applications