stdioFile::WriteString

Description

Write a line to a file. End of line character is appended.

Syntax

int WriteString( LPCTSTR lpcsz )

Parameters

lpcsz
[input] Specifies a pointer to a buffer containing a null-terminated string.

Return

the length of lpcsz.

Examples

EX1

void stdioFile_WriteString_ex1()
{
    //write string.
    string strLine1 = "line 1:";
    string strLine3 = "line 3:";
    stdioFile ff("c:\\test.txt",file::modeCreate | file::modeReadWrite);
    ff.WriteString(strLine1);
    ff.WriteString("line 2:");
    ff.WriteString(strLine3);
}

EX2

//use to export text files with ANSI.
void stdioFile_WriteString_ex2()
{
    string strLine1 = "こんにちは";
    str_to_mbcs_text(strLine1);
    stdioFile ff("e:\\test.txt",file::modeCreate | file::modeReadWrite);
    ff.WriteString(strLine1);
}

Remark

See Also

stdioFile::ReadString

Header to Include

origin.h