2.1.10.40 ocu_read_text_file


Description

read text file to a string. This function will first detect encoding and can handle unicode text

Syntax

BOOL ocu_read_text_file( LPCSTR lpcszFilename, string * pstr, BOOL bGuessEncoding = TRUE )

Parameters

lpcszFilename
[input] full path file name
pstr
[output] resulting file content as a string
bGuessEncoding
[input] Guess file encoding

Return

FALSE if file not found

Examples

EX1

#include <ocu.h>
void bb(string strFile="origin.ini")
{
    string strPath = GetOriginPath() + strFile;
    string str;
    if(ocu_read_text_file(strPath, &str))
        out_str(str);
}

Remark

See Also

Header to Included

ocu.h

Reference