Line Input

Syntax

Line Input #FileNumber, Variable$

Line Input [Prompt$,] Variable$

Remarks

Reads an entire line from an open sequential file and places it into a string variable. In a sequential file, a line is terminated by the carriage-return (ANSI 13) and linefeed (ANSI 10) characters. FileNumber is the number specified by the Open instruction that opened the file for input. For more information about sequential files, see Chapter 9, "More WordBasic Techniques," in Part 1, "Learning WordBasic."

Line Input is similar to the Input and Read statements, but Line Input does not break the line into separate values at commas. It places the entire line into a single string variable. Line Input can accept lines as long as 65,280 characters. Longer lines are truncated. Unlike Read, which takes only the text within quotation marks, Line Input does not distinguish between quotation marks and other characters.

If #FileNumber is omitted, the user is prompted with a question mark (?) in the status bar to type a value. The user presses ENTER to end keyboard input. If Prompt$ is specified, the question mark is not displayed.

Examples

This example places one line from the file designated as #1 into the variable sample$:


Line Input #1, sample$ 

The following example displays the default prompt (a question mark) in the status bar. The variable key$ is defined as the text entered after the question mark.


Line Input key$

The following example displays the prompt "Search text: " in the status bar. The variable target$ is defined as the text entered after the prompt.


Line Input "Search text: ", target$

See Also

Close, Eof(), Input, Input$(), Lof(), Open, Print, Read, Seek, Write