Topic complex |
Text functions |
Function |
read() |
Short |
Reads the string from a text file |
Syntax |
READ(t : INTEGER[; n : INTEGER | c : CHAR]) : STRING |
Parameter |
t : text handle from RESET
n : 1 to 255 (number of chars that are to read)
c : any char
Is n and c not specified: it is default n=1.
|
Return |
String with n chars from text file if c is not specified.
Otherwise maximal 255 chars from the text file until the char c is read. This char is not returned. |
See also: |
|
Description |
The text file has to be opened to read with RESET.
Example: Complete output to text file:
VAR t : INTEGER
VAR c : STRING
SetPara('ec 1') // IO-error handling
IF t:=reset('/home/tdbengine/doc/index.html',0)
THEN
WHILE NOT EOT(t) DO CgiWrite(READ(t)) END
Close(t)
ELSE
CgiWriteHtlm('File can not be opened.')
END
Important: If t=0, it is read from StdIn, which leads to a "hanging" programm at CGI applications!
|