2.2.5.4.4 stdioFile::SetUniCodeType

Description

set UniCode file type if the file doesn't exist bom.

Syntax

BOOL SetUniCodeType( int nUniCodeType )

Parameters

nUniCodeType
[input] UniCode Type = enum UNICODETYPE {
UINICODE8 = 0x1000,
UINICODE16_LITLE = 0x2000,
UINICODE16_BIG = 0x3000,
UINICODE32_LITLE = 0x4000,
UINICODE32_BIG = 0x5000,
};

Return

if nUniCodeType is valid, return TRUE, otherwise, will return FALSE.

UNICODE_NON is invalid Unicode type.

Examples

EX1

void stdioFile_SetUniCodeType_ex1()
{
    string strFilename = "C:\\test.txt";
    stdioFile ff;
    bool bRet = ff.Open(strFilename, file::modeRead);
    if(!bRet)
    {
        out_str("file not found!");
        return;
    }
    
    if(ff.CheckUniCodeBOM() == 0) 
    {
        bool bRet = ff.SetUniCodeType(0x5000); //assume file UniCode type is UINICODE8
        if(!bRet)
            return;
    }
    ff.Close();
}

Remark

See Also

Header to Include

origin.h