hb_MemoWrit()

HB_MEMOWRIT()

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

Syntax

      HB_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, HB_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.

HB_MEMOWRIT() function is used together with HB_MEMOREAD() and MEMOEDIT() to save to disk text from several sources that was edited, searched, replaced, displayed, etc.

Note that HB_MEMOWRIT() do not use the directory settings SET DEFAULT.

HB_MEMOWRIT() vs MEMOWRIT(): HB_MEMOWRIT() never writes the obsolete EOF char at the end of the file.

Examples

      *  This example uses HB_MEMOWRIT() to write the contents of a character
      *  variable to a text file.

         cFile   := "account.prg"
         cString := HB_MEMOREAD( cFile )
         cCopyright := "Melina"

         IF At( "Melina", cString ) == 0               // check for copyright
            HB_MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

MEMOEDIT(), MEMOREAD(), HB_MEMOWRIT()

Advertisements

4 responses to “hb_MemoWrit()

  1. Pingback: OEM to ANSI | Viva Clipper !

  2. Pingback: Harbour All Functions – H | Viva Clipper !

  3. Pingback: Harbour Memo Functions | Viva Clipper !

  4. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s