August 1999
Intermediate to advanced
1488 pages
72h 53m
English
file.readln()
The readln() method of the File object starts at the current pointer position and reads the rest of the line. Once the method is complete, it will return the pointer to the first character on the next line.
Note
The return (\r) and newline (\n) characters are not contained in the string this method returns. However, the newline character determines when the end of the line is reached.
Listing 8.84 reads in the first line of a file and writes it to the user's page.
<SERVER> // Open the files var myLog = new File("/data/logs/today.log"); myLog.open("r"); // Write the first line write(myLog.readln()); // Close the file myLog.close(); </SERVER> ... |
Read now
Unlock full access