Liberty BASIC Help Online

INPUT$( #h, n )
INPUT$(#handle, items)
This permits the retrieval of a specified number of items from an open file or device using #handle.  If #handle does not refer to an open file or device then an error will be reported.  It can also be used to read a character at a time from the mainwindow (see example below).
  'read and display a file one character at a time
  open "c:\autoexec.bat" for input as #1
    if eof(#1) <> 0 then [quit]
    print input$(#1, 1);
    goto [loop]
    close #1
For most devices (unlike disk files), one item does not refer a single character, but INPUT$( ) may return items more than one character in length.  In most cases, use of INPUT #handle, varName works just as well or better for reading devices.
Here is another example which shows reading keypresses in the mainwindow.
'accept characters and display them until Enter is pressed
text$ = ""
while c$ <> chr$(13)
  c$ = input$(1)
  print c$;
  if c$ <> chr$(13) then text$ = text$ + c$
print "You typed:"; text$
File input directly to an array.
Previous versions of Liberty BSIC required you to input to a variable, then filll an array with the variable.  Liberty BASIC 3 removes that limitation and allows you to input from a file directly into an array.  Example:
'input from a file, directly into an array
open "myfile.txt" for input as #handle
while EOF(#handle)=0
input #handle, array$(total)
close #handle
for i = 0 to total
print array$(i)
See also INPUTTO$(#h, c$), Line Input, Input

Copyright (C) 2003 Shoptalk Systems
Liberty BASIC -