Contains the basic functions for file reading/writing.
More...
#include <util.h>
|
| File () |
| Empty constructor.
|
|
| File (const tstring &filename, const tstring &openMode) |
| This constructor redirects to Open() More...
|
|
bool | Close () |
| Closes the file.
|
|
bool | Eof () |
| End of file.
|
|
FILE * | GetInternalPtr () const |
| Direct access to internal file pointer.
|
|
bool | IsOpen () const |
| true if the file is open
|
|
bool | Open (const tstring &filename, const tstring &openMode) |
| Opens a file with the specified mode (read/write, binary, ...) More...
|
|
| operator bool () const |
| true if the file is open
|
|
size_t | Read (void *buffer, size_t byteSize) |
| Read from file into a block of memory. More...
|
|
bool | ReadAll (std::string *all) |
| Get the entire file as string.
|
|
bool | ReadLine (std::string *line, const std::string &delim="\n") |
| Reads until one of the delimiters is found. More...
|
|
void | Seek (int64_t offset, SEEK_FROM mode=FROM_START) |
| Move to a position inside the file.
|
|
int64_t | Size () |
| Get size of file in bytes. More...
|
|
int64_t | Tell () |
| Get current position inside the file.
|
|
size_t | Write (const void *buffer, size_t byteSize) |
| Write a block of memory to file. More...
|
|
bool | Write (const std::string &buffer) |
| Convenience function for writing a string.
|
|
Contains the basic functions for file reading/writing.
neo::File::File |
( |
const tstring & |
filename, |
|
|
const tstring & |
openMode |
|
) |
| |
|
inline |
This constructor redirects to Open()
- Parameters
-
openMode | See the documentation of fopen |
bool neo::File::Open |
( |
const tstring & |
filename, |
|
|
const tstring & |
openMode |
|
) |
| |
|
inline |
Opens a file with the specified mode (read/write, binary, ...)
- Parameters
-
openMode | See the documentation of fopen |
size_t neo::File::Read |
( |
void * |
buffer, |
|
|
size_t |
byteSize |
|
) |
| |
|
inline |
Read from file into a block of memory.
- Returns
- Number of bytes read
bool neo::File::ReadLine |
( |
std::string * |
line, |
|
|
const std::string & |
delim = "\n" |
|
) |
| |
|
inline |
Reads until one of the delimiters is found.
- Returns
- false if EOF is reached and line is empty, meaning no further line can be gotten
int64_t neo::File::Size |
( |
| ) |
|
|
inline |
Get size of file in bytes.
- Returns
- Size in bytes
size_t neo::File::Write |
( |
const void * |
buffer, |
|
|
size_t |
byteSize |
|
) |
| |
|
inline |
Write a block of memory to file.
- Returns
- Number of bytes written
The documentation for this class was generated from the following files:
- include/neo/util.h
- include/neo/util.inl