line input - read a line from the keyboard


line input[;] [Prompt;] StrVar


Line input reads a line from the keyboard into the specified string variable, ignoring delimiters.  StrVar must be the name of a string variable or string array element to which the line will be assigned.  If Prompt is present, it is displayed on the screen as a prompt before input is accepted.  Nothing else is printed unless it is part of the prompt. 

If the optional semicolon is present, no NEWLINE is printed following entry of the line by the user, leaving the cursor on the same line as the response. 


The program
	yn$ = "n"
	answer$ = left$(yn$, 1)
	while answer$ <> "y" and answer$ <> "Y"
		line input "Enter your last name:"; a$
		print "Last name:"; a$
		line input "Is this correct? [yes]"; yn$
		answer$ = left$(yn$, 1)
illustrates the use of line input. 


line input #


In Microsoft BASIC, line input is used for input from the userís keyboard (terminal) and line input # is used for input from disk files.  In the UNIX environment, the distinction between terminals and disk files is not as strong: standard input may be redirected to a disk file or a terminal may be open as a file.  To accommodate this flexibility, the distinction between line input and line input # must be merely syntactic rather than functional.  Thus,

line input #FileNum, [;] [Prompt;] StrVar

is the synopsis of the line input # statement for terminal input (as described above) when FileNum refers to a file that is a terminal.  Although the organization of these manual pages implies the older, less flexible system, this organization is maintained only for convenience, line input and line input # do not differ functionally.  The difference in behavior between terminal input and disk file input depends entirely upon the type of file in use. 

If the environment variable BASECHO is set to a non-null value when a Basmark QuickBASIC program begins executing, the BASIC input/output facility operates differently in order to support half-duplex terminals such as the IBM 3278.  In this modified behavior of the input/output facility, the terminal modes are not altered, so that the usual erase and kill processing and echoing of terminal input are performed.  In the specific case of line input, appearance of the semicolon following line input will not cause suppression of the echo of the newline; the semicolon is simply ignored. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber