2.2.5.4.5 stdioFile::stdioFile

Description

The default constructor does not open a file but rather sets m_hFile to file::hFileNull.

Syntax

stdioFile( )


stdioFile( LPCTSTR lpszFileName, UINT nOpenFlags )

Parameters

lpszFileName
[input] Specifies a string that is the path to the desired file.
The path can be relative or absolute.
nOpenFlags
[input] Sharing and access mode. Specifies the action to take when the file is opened.

Return

Examples

EX1

void stdioFile_stdioFile_ex1()
{
    //Create a new standard I/O file.
    //Get the origin folder path.
    string strOriginPath;
    strOriginPath = GetAppPath() + "OriginC";
    string strFile = strOriginPath + "\\test.txt";
    stdioFile ff(strFile, file::modeCreate | file::modeReadWrite);
}

Remark

Creates a stdioFile object and opens the file having the path specified by the parameter lpszFileName. This constructor combines the functions of the default constructor stdioFile() and the Open member function. An exception is thrown if an error occurs while opening the file. Depending on the severity of the error, the user should be alerted by an exception handler.

See Also

Header to Include

origin.h