Return the text file’s contents as a character string


      MEMOREAD( <cFileName> ) --> cString


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


Returns the contents of a text file as a character string.

If <cFileName> cannot be found or read MEMOREAD returns an empty string (“”).


MEMOREAD() is a function that reads the content of a text file (till now) from disk (floppy, HD, CD-ROM, etc.) into a memory string. In that way you can manipulate as any character string or assigned to a memo field to be saved in a database.

MEMOREAD() function is used together with MEMOEDIT() and MEMOWRIT() to get from disk text from several sources that would be edited, searched, replaced, displayed, etc.

It is used to import data from other sources to our database.

Note: MEMOREAD() does not use the settings SET DEFAULT or SET PATH to search for <cFileName>. It searches for <cFileName> in the current directory. If the file is not found, then MEMOREAD() searches in the DOS path.

Over a network, MEMOREAD() attempts to open <cFileName> in read-only mode and shared. If the file is used in mode exclusive by another process, the function will returns a null string (“”).


      *  This example uses MEMOREAD() to assign the contents of a text
      *  file to a character variable for later search

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

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




All (64K)


Library is rtl



4 responses to “MemoRead()

  1. Pingback: Harbour All Functions – M | Viva Clipper !

  2. Pingback: OEM to ANSI | 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: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.