MEMOREAD()
Return the text file's contents as a character string
- Syntax
-
- MEMOREAD( <cFileName> ) --> cString
- 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.
- Returns
-
- Returns the contents of a text file as a character string. The maximum size of the file that can be read is the same as the maximum size of a character string (more than 2 Mb). It has not the 64 Kb limit as in Clipper. If <cFileName> cannot be found, nor read, function returns a null string ("").
- Description
-
- 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 ("").
- Is one of the most useful Clipper functions!, it really makes simple
Examples
* 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 )
IF AT( "Melina", cString) == 0 // check for copyright
MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
ENDIF
- Status
- Ready
- Compliance
-
- MEMOREAD() is fully CA-Clipper compliant.
- Platforms
-
- All
- Files
-
- Library is rtl
- See Also