Return the text file’s contents as a character string
HB_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 HB_MEMOREAD returns an empty string (“”).
HB_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.
HB_MEMOREAD() function is used together with MEMOEDIT() and HB_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: HB_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 HB_MEMOREAD() searches in the DOS path.
Over a network, HB_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 (“”).
HB_MEMOREAD() vs MEMOREAD(): HB_MEMOREAD() is identical to MEMOREAD() except it won’t truncate the last byte (on non-UNIX compatible systems) if it’s a EOF char.
* This example uses HB_MEMOREAD() to assign the contents of a text * file to a character variable for later search cFile := "account.prg" cString := HB_MEMOREAD( cFile ) cCopyright := "Melina" IF At( "Melina", cString ) == 0 // check for copyright HB_MEMOWRIT( cFile, cCopyright + cString ) // if not, add it! ENDIF
Library is rtl
MEMOEDIT(), HB_MEMOWRIT(), REPLACE, MEMOREAD()