August 1999
Intermediate to advanced
1488 pages
72h 53m
English
file.write(string)
The write() method of the File object writes the string passed to the method to the file on which it was invoked. The method returns true if it was successful and false otherwise. You should use the read() or readln() methods to read any string information from other files that you want to write. If you need to write binary information, use the writeByte() method.
Listing 8.87 writes "Hello, World!" to the summary file opened.
<SERVER> // Set an instance of a File var mySummary = new File("/data/logs/summary.log"); // Open the log file for writing mySummary.open("w"); // Write a string to the file mySummary.write('Hello, ... |
Read now
Unlock full access