xHarbour Reference Documentation > Function Reference |
Writes a character string or a memo field to a file.
MemoWrit( <cFileName>, <cString> ) --> lSuccess
The function returns .T. (true) when the string <cString> could be written to the file <cFileName>, otherwise .F. (false) is returned.
MemoWrit() creates a file, writes the character string <cString> to it, and closes the file. If the file exists already, it is overwritten without warning. When the file cannot be created, the return value is .F. (false).
Note: the function writes an end-of-file marker (Chr(26)) to the created file. That means, the file created by MemoWrit() contains one byte more than the input string <cString>. This must be taken into consideration if the file is later read using MemoRead().
See also: | FCreate(), FWrite(), MemoEdit(), MemoRead() |
Category: | Character functions , Memo functions |
Source: | rtl\memofile.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example contains the shortest possible source code of // a complete text file editor (8 lines of code). PROCEDURE Main( cFileName ) IF Empty( cFileName ) ? "No file name specified" QUIT ENDIF MemoWrit( cFileName, MemoEdit( MemoRead( cFilename ) ) ) RETURN
http://www.xHarbour.com