|
TRF Language Model
|
file class. More...
#include <wb-file.h>
Public Member Functions | |
| File () | |
| constructor More... | |
| File (const char *path, const char *mode, bool bHardOpen=true) | |
| constructor More... | |
| ~File () | |
| destructor More... | |
| virtual bool | Open (const char *path, const char *mode, bool bHardOpen=true) |
| Open file. More... | |
| virtual bool | Reopen (const char *model) |
| re-open the file More... | |
| virtual void | Close () |
| close the file More... | |
| operator FILE * () | |
| transform the class to FILE pointer More... | |
| virtual char * | GetLine (bool bPrecent=false) |
| Read a line into the buffer. More... | |
| virtual bool | GetLine (char *str, int maxLen=MAX_SENTENCE_LEN) |
| read a line into buffer str. More... | |
| virtual void | Print (const char *p_pMessage,...) |
| print More... | |
| virtual int | Scanf (const char *p_pMessage,...) |
| scanf More... | |
| void | Flush () |
| clean buffer More... | |
| void | Reset () |
| reset position More... | |
| bool | Good () const |
| return if the file is accessible. More... | |
| template<typename TYPE > | |
| void | PrintArray (const char *pformat, TYPE *pbuf, int num) |
| print a array into file More... | |
Public Attributes | |
| FILE * | fp |
| file pointer More... | |
| int | nLine |
| the number of reading from file More... | |
| char * | pStrLine |
| store the string get from file More... | |
| string | strFileName |
| stroe the file name More... | |
| bool | bOver |
| record the if the buffer is overflow More... | |
| short | nBuf |
| record the buffer is nBuf times of GS_SENTENCE_LEN More... | |
file class.
There are several convenient functions in this class:
|
inline |
|
inlinevirtual |
|
virtual |
Read a line into the buffer.
| [in] | bPrecent | if true, then print the precent in the tille |
Definition at line 47 of file wb-file.cpp.
|
virtual |
read a line into buffer str.
Definition at line 88 of file wb-file.cpp.
|
inline |
|
virtual |
Open file.
| [in] | path | the file path |
| [in] | mode | open mode {'w', 'r', 't', 'b', 'a'} |
| [in] | bHardOpen | if ture, report error if opening the file fails. |
Definition at line 23 of file wb-file.cpp.
|
inline |
|
virtual |
Definition at line 115 of file wb-file.cpp.
|
inline |
|
virtual |
re-open the file
Definition at line 42 of file wb-file.cpp.
|
inline |
|
virtual |
scanf
Definition at line 132 of file wb-file.cpp.
| short wb::File::nBuf |