stdioFile

 

Name

stdioFile

Remark

The Origin C stdioFile class provides read/write access to text and binary files using buffered stream io. However, the stdioFile class does not support stream io to stdin, stdout, and stderr. See also the file class for unbuffered io to binary files. The stdioFile class is derived from the file class from which it inherits methods and properties.

Hierarchy

Examples

EX1

void stdioFile_ex1()
{
    // Get the Origin folder path
    string strOriginPath, strFile;
    strOriginPath = GetAppPath() + "OriginC";
    strFile = strOriginPath + "\\test.txt";
    
    // Create a new standard I/O file.
    stdioFile ff(strFile, file::modeCreate | file::modeReadWrite);
    
    // Write strings
    string strLine1 = "line 1:";
    string strLine3 = "line 3:";
    ff.WriteString(strLine1);
    ff.WriteString("line 2:");
    ff.WriteString(strLine3);
}

header to Include

origin.h

Reference

Members

Name Brief Example
CheckUniCodeBOM check UniCode file if has bom Examples
ReadString Read a line from the current file position into a string and advance the file position. Examples
Scan scan file from the beginning to look for line separation info Examples
SetUniCodeType set UniCode file type if the file doesn't exist bom. Examples
stdioFile The default constructor does not open a file but rather sets m_hFile to file::hFileNull. Examples
WriteString Write a line to a file. End of line character is appended. Examples