Topic complex |
Text functions |
Function |
readln() |
Short |
Reads a line from a text file |
Syntax |
READLN(t : INTEGER) : STRING |
Parameter |
t : text handle from RESET |
Return |
next line from the text file. |
See also: |
|
Description |
Depending on the operating system it is read till the next word wrap.
A word wrap is defined as
* CRLF (Win32)
* LF (Linux, FreeBSD) // CR is ignored here
* EOT (=^Z under Win32, ^D under Linux, FreeBSD)
* physical end of file
In the current version a line can has maximal 255 chars.
Attention: If a text file is saved in ANSI format, it has to be opened with reset(....,0).
|
Example 1: Timeout + ReadLn from console
The user has 10 seconds to enter his account ID.
PROCEDURE Input : INTEGER
VAR id : STRING
Timeout(10)
writeln(0,'Your account id: ')
id:=readln(0)
TimeOut(0)
RETURN 1
ENDPROC
PROCEDURE Main
cgiclosebuffer
IF Input THEN
writeln(0,'Your input will be processed now...')
ELSE
writeln(0,'Cancel forced by timeout')
END
ENDPROC
|
Write a comment:
|