[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function            WRITEFILE()
Action              Writes a line or lines  to a text file
Returns
Category            File
Syntax              Writefile(<expC1|expN>,<expC2>)
Description         Writes line(s) of text with CR LF to
                    a file referenced either as a file handle
                    <expN> or a filename <expC1>. Writes either
                    a single line contained in <expC2> or all
                    of the contents of a character array named
                    as <expC2> to the file.

Examples
                    1. WRITEFILE('ERROR.TXT','THERE WAS AN ERROR')

                    2. declare errors[3]
                       errors[1] = 'There was an error'
                       errors[2] = 'Error # 61765     '
                       errors[3] = dtoc(date)
                       writefile('ERROR.TXT','ERRORS')

                    3. handle = fopen("error.txt",1)
                       declare errors[3]
                       errors[1] = 'There was an error'
                       errors[2] = 'Error # 61765     '
                       errors[3] = dtoc(date())
                       writefile(handle,'ERRORS')

Notes               IF A FILENAME IS PASSED, THE FILE IS OPENED AND
                    CLOSED BY THE FUNCTION.

                    IF A FILE HANDLE IS PASSED, THE FILE IS LEFT OPEN.

                    IF A CHARACTER ARRAY IS PASSED, EACH ELEMENT IS
                    WRITTEN TO A SEPERATE LINE IN THE FILE.

                    DO NOT PASS AN ARRAY - PASS AN ARRAY NAME IN QUOTES

                    IF THE FILE DOES NOT EXIST, IT IS CREATED.
Found in (prg)......S_WRITEF.PRG

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson