up previous next
Get

read characters from a device

Syntax
Get(D: DEVICE, N: INT): LIST of INT

Description
***** NOT YET IMPLEMENTED *****

This function reads N characters from D and returns the list of their ASCII codes.

Example
  D := OpenIFile("io.cpkg");  -- open the file "io.cpkg"
  Get(D,10);  -- get the first 10 characters
[45, 45, 32, 105, 111, 100, 101, 118, 46, 112]
-------------------------------
  ascii(It); convert the ASCII code to characters
-- iodev.p
-------------------------------
  ascii(Get(D,10));  -- get the next 10 characters and convert
kg : 0.1 :
-------------------------------
  Close(D);
The instruction Get(DEV.STDIN,3) , for instance, will read 3 characters typed in by the user. Clever use of this function can be used to prompt a user for input to a function, although it is usually easier for functions to take input directly as arguments. NOTE: this function does not work properly under the GUI Interface.
See Also