MEMOWRIT()

Write a memo field or character string to a text file on disk

Syntax

MEMOWRIT( <cFileName>, <cString>, [<lWriteEof>] ) --> lSuccess

Arguments

<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.)

Returns

Function returns true (.T.) if the writing operation was successful; otherwise, it returns false (.F.).

Description

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.

Note: There is a third parameter (optional), <lWriteEof>, (not found in Clipper) which let to programmer change the default behavior of - allways - to write the EOF character, CHR(26) as in Clipper. If there is no third parameter, nothing change, EOF is written as in Clipper, 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.

It is used to export the database to another format.

Note: MEMOWRIT() do not use the directory settings SET DEFAULT.

Is one of the most useful Clipper functions!, it really makes simple
Examples
      *  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

Status

Ready

Compliance

MEMOWRIT() is fully CA-Clipper compliant.

Platforms

All

Files

Library is rtl

See Also