readLine
Syntax
readLine(handle)
Details
Read a line from the given file. The return line doesn't include the line delimiter. If the file reaches the end, the function will return a null object which can be tested by the isVoid function.
Parameters
handle is the handle of the file to read.
Returns
The returned line does not include the line delimiter. If the end of the file is reached, the function returns a NULL object, which can be tested with isVoid.
Examples
x=`IBM`MSFT`GOOG`YHOO`ORCL;
eachRight(writeLine, file("test.txt","w"), x);
// output: [1,1,1,1,1]
fin = file("test.txt")
do{
x=fin.readLine()
if(x.isVoid()) break
print x
}while(true);
/* output:
IBM
MSFT
GOOG
YHOO
ORCL
*/
Related function: writeLine
