[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
MEMOREAD()
Return the contents of a disk file as a character string
------------------------------------------------------------------------------
Syntax
MEMOREAD(<cFile>) --> cString
Arguments
<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.
Returns
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 ("").
Description
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
CA-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 ("").
Examples
. 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.
ELSE
MEMOWRIT(cFile, MEMOEDIT(cString))
RETURN .T.
ENDIF
Files Library is EXTEND.LIB.
See Also:
MEMOEDIT()
MEMOWRIT()
REPLACE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson