Home   |   Products   |   Documentation
 

dev net revision
29 July 2008
 

 
 

WriteTextFile Method

static bool CMarkup::WriteTextFile(
  MCD_CSTR szFileName,
  MCD_STR& strDoc,
  MCD_STR* pstrError=NULL,
  int* pnFlags=NULL
  );

WriteTextFile is a static function (with no knowledge of the data members of a CMarkup object) used internally by the Save method. It writes a string to file, creating the file or replacing it if it exists, sometimes performing a text encoding conversion. See ANSI and Unicode Files. WriteTextFile is the corresponding function to ReadTextFile.

The flags described below are only in CMarkup Developer.

The last argument to the WriteTextFile method is the flags. This is an optional argument but it is needed to write the file in UTF-16 or with a UTF-8 preamble. WriteTextFile will write the file with the BOM and encoding corresponding to the flag. If you are going to write the same file back to disk after modifying it, it is best to get the flags from ReadTextFile and keep them to pass them to WriteTextFile so the file is saved the same way it is loaded. For more on these flags, see UTF-8 Files and the Preamble and UTF-16 Files and the Byte Order Mark (BOM).

 
 

Question or comment about this article?

©Copyright 2008 First Objective Software, Inc. All rights reserved.