Return the contents of a disk file as a character string

     MEMOREAD(<cFile>) --> cString


     <cFile> is the name of the file to read from disk.  It must include
     an extension, if there is one, and can optionally include a path.


     MEMOREAD() returns the contents of a text file as a character string.
     The maximum file size that can be read is 65,535 characters (64K)--the
     maximum size of a character string.  If <cFile> cannot be found,
     MEMOREAD() returns a null string ("").


     MEMOREAD() is a memo function that reads a disk file into memory where
     it can be manipulated as a character string or assigned to a memo field.
     MEMOREAD() is used with MEMOEDIT() and MEMOWRIT() to edit an imported
     disk file, and then write it back to disk.  MEMOREAD() searches for
     <cFile> beginning with the current DOS directory.  If the file is not
     found, MEMOREAD() searches the DOS path.  MEMOREAD() does not use the
     Clipper DEFAULT or PATH to search for <cFile>.

     In a network environment, MEMOREAD() attempts to open the specified file
     shared and read--only.  If the file is opened exclusive by another
     process, MEMOREAD() returns a null string ("").


     .  This example uses MEMOREAD() to assign the contents of a text
        file to the Notes memo field and to a character variable:

        REPLACE Notes WITH MEMOREAD("Temp.txt")
        cString = MEMOREAD("Temp.txt")

     .  This example defines a function that edits a disk file:

        FUNCTION Editor( cFile )
           LOCAL cString
           IF (cString := MEMOREAD(cFile)) == ""
              ? "Error reading " + cFile
              RETURN .F.
              MEMOWRIT(cFile, MEMOEDIT(cString))
              RETURN .T.

 Files   Library is EXTEND.LIB.



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 )

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.