My Project
|
#include <ReadWriteTextFile.hh>
Public Member Functions | |
ReadWriteTextFile (string _FileName, UInt4 _LockFlag=0) | |
~ReadWriteTextFile () | |
void | ReSetTarget (string _FileName, UInt4 _LockFlag=0) |
void | Read () |
vector< string > | Put () |
void | Write (vector< string > StrVec) |
This class cannot work on MacOS system. Because the function of "fopen()" is different from that on Linux and FreeBSD system.
ReadWriteTextFile::ReadWriteTextFile | ( | string | _FileName, |
UInt4 | _LockFlag = 0 |
||
) |
Constructor. In ordinary case, you can omit the second argument. The target file will be open in append mode.
Destructor. When this method is called, the file descriptor defined in the constructor will be closed.
void ReadWriteTextFile::Read | ( | ) |
The file descriptor opened by the constructor is re-opened in read-mode, and read the target file. The contents of the target file can be obtained with vector<string> Put().
void ReadWriteTextFile::Write | ( | vector< string > | StrVec | ) |
The argument of vector<string> is written to the target file. Each element in "StrVec" corresponds to each line in the file. The target file will be closed in the destructor of this class.