This class provides support for reading and writing text files.
More...
Detailed Description
This class provides support for reading and writing text files.
- Example:
-
List of all members.
Member Function Documentation
int open |
( |
const string& in |
filename, |
|
|
const string& in |
mode | |
|
) |
| | [private] |
Opens file.
- Parameters:
-
| filename | Path to the file. |
| mode | String containing a file access mode. It can be:
"r" | Open the file for reading. |
"w" | Open the file for writing (overwrites existing files). |
"a" | Open the file for appending. |
|
- Returns:
- If the file is successfully opened, a zero value is returned. Otherwise, -1 is returned.
Closes file.
- Returns:
- If the file is successfully closed, a zero value is returned. On failure, -1 is returned.
int getSize |
( |
|
) |
const [private] |
Returns the size of the file.
bool isEndOfFile |
( |
|
) |
const [private] |
Returns true
if the end of the file has been reached.
int readString |
( |
uint |
length, |
|
|
string& out |
str | |
|
) |
| | [private] |
Reads a specified number of bytes into the string.
int readLine |
( |
string& out |
str |
) |
[private] |
Reads to the next new-line character.
int writeString |
( |
const string& in |
string |
) |
[private] |
Writes a string to the file.
- Parameters:
-
| string | String to be written. |
- Returns:
- The total number of characters successfully written. If this number differs from the length of the input string, it indicates an error.
int getPos |
( |
|
) |
const [private] |
Returns the current position of the file.
- Returns:
- On success, the current value of the position is returned. If an error occurs, -1 is returned.
int setPos |
( |
int |
pos |
) |
[private] |
Sets the current position of the file.
- Parameters:
-
- Returns:
- If successful, the function returns a zero value. Otherwise, it returns -1.
int movePos |
( |
int |
delta |
) |
[private] |
Changes current position of the file by adding delta to the current position.
- Parameters:
-
| delta | Number of bytes to offset from the current position. |
- Returns:
- If successful, the function returns a zero value. Otherwise, it returns -1.
Reads next word (character sequence without whitespaces) from the file.
int readNumber |
( |
|
) |
[private] |
Reads next integer number from the file.
uint8 readUint8 |
( |
|
) |
[private] |
uint16 readUint16 |
( |
|
) |
[private] |
uint32 readUint32 |
( |
|
) |
[private] |
uint64 readUint64 |
( |
|
) |
[private] |
uint readData |
( |
uint |
count, |
|
|
uint8[]& |
data | |
|
) |
| | [private] |
bool writeUint8 |
( |
uint8 |
data |
) |
[private] |
bool writeUint16 |
( |
uint16 |
data |
) |
[private] |
bool writeUint32 |
( |
uint32 |
data |
) |
[private] |
bool writeUint64 |
( |
uint64 |
data |
) |
[private] |
bool writeData |
( |
uint8[]& |
data, |
|
|
uint |
count | |
|
) |
| | [private] |