inchar (STRING*)

inkey (STRING*)

Enters keyboard input into the given string. The local keyboard layout is activated. inchar() waits until a key is pressed, reads it into the string, and returns its ASCII value; inkey() reads characters into the string until the input is terminated with [Enter] or [Tab].

Parameters:

STRING* - String pointer to receive keyboard entry, or NULL for just returning the key value.

Returns:

1 Input terminated prematurely because inkey_active was set to 0 or another keyboard entry was active at the same time.
9 Input terminated by [Tab]
13 Input terminated by [Enter]
27 Input aborted by [Esc]
72 Input aborted by [Up]
73 Input aborted by [PgUp]
80 Input aborted by [Down]
81 Input aborted by [PgDn]
other ASCII value of the pressed key.

Modifies:

STRING String receives keyboard entry.
inkey_active Set to 1 (inkey) or 2 (inchar) during entry.

Remarks:.

Examples (lite-C):

STRING* entry_str = "                      "; // long empty string
...
var key = inkey(entry_str); // wait until [enter] pressed
if (key == 13)
  process_entry(entry_str); 
...

STRING* string1 = "";
STRING* string2 = "";
...
while(1) {
if (inchar(string1) == 13) break;
str_cat(string2,string1);
}

See also:

inkey_active, str_cursor, key_a,...,key_z, on_, key_for_string, str_for_key, key_set

► latest version online