Write a memo field or character string to a text file on disk
MEMOWRIT( <cFileName>, <cString>, [<lWriteEof>] ) --> lSuccess
<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.
<cString> Is the memo field or character string, to be write to <cFile>.
<lWriteEof> Is a logic variable that settle if the “end of file” character – CHR(26) – is written to disk. This parameter is optional. By default is true (.T.)
Function returns true (.T.) if the writing operation was successful; otherwise, it returns false (.F.).
This a function that writes a memo field or character string to a text file on disk (floppy, HD, CD-ROM, etc.) If you not specified a path, MEMOWRIT() writes <cFileName> to the current directory. If <cFileName> exists, it is overwritten.
There is a third parameter (optional), <lWriteEof>, (not found in CA-Cl*pper) which let to programmer change the default behavior of – always – to write the EOF character, CHR(26) as in CA-Cl*pper.
If there is no third parameter, nothing change, EOF is written as in CA-Cl*pper, the same occurs when <lWriteEof> is set to .T. But, if <lWriteEof> is set to .F., EOF char is Not written to the end of the file.
MEMOWRIT() function is used together with MEMOREAD() and MEMOEDIT() to save to disk text from several sources that was edited, searched, replaced, displayed, etc.
Note that MEMOWRIT() do not use the directory settings SET DEFAULT.
* This example uses MEMOWRIT() to write the contents of a character variable to a text file. cFile := "account.prg" cString := MEMOREAD( cFile ) IF At( "Melina", cString ) == 0 // check for copyright MEMOWRIT( cFile, cCopyright + cString ) // if not, add it! ENDIF
Library is rtl
MEMOEDIT(), MEMOREAD(), HB_MEMOWRIT()