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

Username:   Password: 
 RegisterRegister   
 How can I use getch to input multiple characters?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
asdfasdf123




PostPosted: Tue Jan 13, 2015 11:59 am   Post subject: How can I use getch to input multiple characters?

What is it you are trying to achieve?
Explained in the title.


What is the problem you are having?
When I try to input multiple characters with getch, it says "Argument is the wrong type".


Describe what you have tried to solve this problem
Looking up the problem.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


import GUI
setscreen ("graphics:max;max")
var c : string (2)
var b : int := GUI.CreateButton (maxx - 100, 0, 0, "Quit", GUI.Quit)
loop
    exit when GUI.ProcessEvent
    getch (c)
    put (c)
end loop



Please specify what version of Turing you are using
4.1 1.0.1
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 13, 2015 2:30 pm   Post subject: RE:How can I use getch to input multiple characters?

Read the documentation for details -- getch

The argument is defined to be of type string(1) (so it is expected for type string(2) to be of "wrong type"). You can use getch twice, and probably should -- there is a long time (from a fast computer's perspective) in between two key presses.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: