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! ENDIF
Library is rtl
MEMOEDIT(), MEMOWRIT(), REPLACE, HB_MEMOREAD()