methods to write text to an FileIO object:
• FileIO.write(str) - writes a string.
• FileIO.writeExp(container) - writes the contents of a container.
Elements are separated by character defined in
FileIO.outFieldDelimiter().
• FileIO.writeChar(int) - writes a unicode character represented by
an integer.
The following is sample code which writes a simple string to a text file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | FileName fileName = 'c:\\test.txt'; FileIoPermission permission; FileIO fileIO; str outputText; #File ; permission= new FileIoPermission(filename,#io_write); permission.assert(); fileIO= new FileIO(filename, #io_write); if (fileIO) { outputText = "text that will go into the text file."; fileIO.write(outputText); //write the text to the file. fileIO.finalize(); //finish the file. } |
Best Regards,
Hossein Karimi
No comments:
Post a Comment