xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

MemoRead()

Reads an entire file from disk into memory.

Syntax

MemoRead( <cFileName> ) --> cString

Arguments

<cFileName>
This is a character string holding the name of the file to read. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory.

Return

The function returns the entire contents of file <cFileName> as a character string. If the file is not found, an empty string ("") is returned.

Description

MemoRead() provides the fastest way of reading the entire contents of a file from disk and assign it to a memory or field variable. The function searches a file only in the current directory, if <cFileName> is not a full qualified file name. The settings of SET PATH and SET DEFAULT are ignored.

The file is opened as read-only and in shared mode. If this fails due to another process having obtained exclusive access to the file, or if the file is not found, the return value is an empty string ("").

Info

See also:MemoEdit(), MemoLine(), MemoWrit(), REPLACE
Category: Character functions , Memo functions
Source:rtl\memofile.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// See the examples of function MemoEdit() or MemoLine() for
// a usage scenario of MemoRead()

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe