The Write function writes data to the specified file.
Used to write data to an external text file which can be used in other applications.
<filename>, string, name of the file where the data should be written. It is not necessary to create the file first ; if the file does not exist, it is created when the first write is performed. If the file already exists, the write is done after the existing data. If you use Unicode encoding, you need to create the file using CreateUnicodeFile function before calling Write function and write Unicode strings.
<buffer>, string, variable only. The content of this variable is written at the end of <filename>. The Write is always performed sequentially. It is not possible to change the write pointer.
<n>, integer, number of bytes to write. Only the first n bytes of <buffer> are written in <filename>. If <buffer> contains less than <n> characters, it is padded with spaces.
<separator>, string. If it is used, <buffer> is written at the end of <filename> and then <separator> is written.
CRLF, keyword, carriage-return-line-feed keyword (ASCII code representation : chr$(13)+chr$(10)). This character CRLF (end of line) is written after <buffer>.
ret, optional numeric return value. If the function succeeds, the return value is 0. If the function fails, the return value is a nonzero value (see File Functions Error Codes).
'This script writes some data into a txt file and then Read function is used to read its records. 'Read the file just created
'Write 5 records in filename$
'Display the results
'Read the file just created