Re: Convert ASCII code to equivalent numerical value

new topic     » goto parent     » topic index » view thread      » older message » newer message
alrobnett said...

given:

integer key

key = wait_key

If the key pressed is 1, then the value in key = 49.
I need a value of 1.
I could say:
key -= 48
Is there a more sanitary way?

Take a look in the manual for the following:

8.3.4.7 prompt_number

include std/console.e

namespace console

public function prompt_number(sequence prompt, sequence range)

Prompts the user to enter a number, and returns only validated input.

Parameters:

st : is a string of text that will be displayed on the screen. (should be prompt)

s : is a sequence of two values {lower, upper} which determine the range of values that the user may enter. s can be empty, {}, if there are no restrictions. (should be range)

Returns:

An atom, in the assigned range which the user typed in.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu