cstdiofile_utf8.h

来自「存UTF8格式文件」· C头文件 代码 · 共 29 行

H
29
字号
#pragma once
#if !defined(CSTDIOFILE_UTF8_INC_)
#define CSTDIOFILE_UTF8_INC_

/**
 * This class adapts the CStdioFile MFC class to read and write to UTF8 
 * encoded files. If the application is compiled with unicode support, all
 * UTF8 character sequences are handled, else only the normal ASCII7 subset.
 */
class CStdioFile_UTF8 : public CStdioFile
{
public:
	// Duplicate the standard constructors
	CStdioFile_UTF8() : CStdioFile() {}
	CStdioFile_UTF8(FILE* pOpenStream) : CStdioFile(pOpenStream) {}
	CStdioFile(LPCTSTR lpszFileName, UINT nOpenFlags) : CStdioFile(lpszFileName, nOpenFlags) {}

    // Override these methods for UTF8 conversion
	virtual LPTSTR ReadString(LPTSTR lpsz, UINT nMax);
	virtual BOOL ReadString(CString& rString);
	virtual void WriteString(LPCTSTR lpsz);

    // Read and write an optional Byte Order Mark
	BOOL ReadBOM();
	void WriteBOM();
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?