Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to input a command without pressing enter
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
blankout




PostPosted: Tue Mar 24, 2009 3:14 pm   Post subject: How to input a command without pressing enter

Is there any way that i can have the user input anything like yes or no, and have the action completed without having to press enter
i.e. as soon as the user presses 'y', the command is input without ever pressing enter
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue Mar 24, 2009 3:52 pm   Post subject: RE:How to input a command without pressing enter

Several ways:

get someString : 1
var someChar : char := getchar
getch someChar

Alternately, you could look into Input.KeyDown(). More complex, gives more information, but excessive for a Y/N question.
saltpro15




PostPosted: Tue Mar 24, 2009 5:09 pm   Post subject: RE:How to input a command without pressing enter

use getch
period
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: