{{fbdoc item="title" value="LINE INPUT #"}}----
Reads one line of text from a file

{{fbdoc item="syntax"}}##
	**Line Input** #//file number//, //string_variable_1//
		or
	**Line Input** #//file number//, //string_variable_2// , //max_length//
##
{{fbdoc item="param"}}
	##//file number//##
		file number of an file opened for ##[[KeyPgInputfilemode|Input]]##
	##//string_variable_1//##
		variable-length or fixed_length (and known) string, to receive the line of text
	##//string_variable_2//##
		dereferenced {z|w}string pointer or {z|w}string variable passed by reference (string buffer size unknown for both), to receive the line of text
	##//max_length//##
		maximum number of characters allowed to be written to the string buffer, including the NULL terminator

{{fbdoc item="desc"}}
	Reads a line from an open text file (opened for ##[[KeyPgInputfilemode|Input]]## through a bound file number) and stores it in a string variable.  
	
	A line of text ends at, but does not include the end of line characters. An end of line character may be the ##LF## character (##[[KeyPgChr|Chr]](10)##) or the ##CRLF## character pair (##[[KeyPgChr|Chr]](13,10)##).
	
	Two syntaxes are available:
		- The first syntax is only allowed when the string buffer size (provided by ##//string_variable_1//##) is either variable or fixed (and known).
		- The second syntax with ##//max_length//## parameter is only allowed when the string buffer size (provided by ##//string_variable_2//##) is unknown. This happens for dereferenced ##[[KeyPgZstring|Zstring]]##/##[[KeyPgWstring|Wstring]]## pointers, or ##[[KeyPgZstring|Zstring]]##/##[[KeyPgWstring|Wstring]]## variables passed by reference. This can used to truncate the text line to be read, or avoid overflowing beyond allocated data of the provided string buffer.

{{fbdoc item="ex"}}
	{{fbdoc item="filename" value="examples/manual/fileio/lineinput.bas"}}%%(freebasic)
Open "myfile.txt" For Output As #1
Print #1, "Hello, World"
Close #1

Dim s As String
Open "myfile.txt" For Input As #1
Line Input #1, s
Close #1
Print "'" & s & "'"

Const maxlength = 6  '' max 5 characters plus 1 null terminal character
Dim pz As Zstring Ptr = Callocate(maxlength, Sizeof(Zstring))
Open "myfile.txt" For Input As #1
Line Input #1, *pz, maxlength
Close #1
Print "'" & *pz & "'"
Deallocate(pz)
%%
{{fbdoc item="ver"}}
	- Before fbc 1.10.0, the second syntax (with ##//max_length//## parameter) was not supported.

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##[[KeyPgLineinput|Line Input]]##
	- ##[[KeyPgInputPp|Input #]]##
	- ##[[KeyPgOpen|Open]]##
	- ##[[KeyPgInputfilemode|Input (file mode)]]##

{{fbdoc item="back" value="CatPgFile|File I/O Functions"}}