Class File. API for working with file. More...
#include <ev3cxx_file.h>
Public Member Functions | |
File (const char *filename, const char *mode="w+") | |
Constructor of class File. More... | |
virtual | ~File () |
Destructor of class File. Close the file if is open. | |
FILE * | operator() () |
Return file descriptor to open file or NULL. | |
virtual bool_t | open (const char *filename, const char *mode="w+") |
Return file descriptor to open file or NULL. More... | |
virtual bool_t | isOpen () |
Return if is file open. More... | |
virtual int | close () |
Close the file if is open. More... | |
int | write (char ch) |
Write character to file. More... | |
int | readChar () |
Read character from file. More... | |
template<typename T > | |
std::enable_if< std::is_integral< T >::value, int >::type | readNumber (T &val) |
Read number from file. More... | |
template<typename T > | |
std::enable_if< std::is_floating_point< T >::value, int >::type | readNumber (T &val) |
void | rewind () |
Set position of stream to the beginning. More... | |
Protected Attributes | |
FILE * | m_filedesc |
file of this class | |
Class File. API for working with file.
Definition at line 20 of file ev3cxx_file.h.
|
inline |
Constructor of class File.
filename | Path to file. |
mode | Mode in which will be file open. More info http://www.cplusplus.com/reference/cstdio/fopen/ Default mode is "w+": Create an empty file and open it for update (both for input and output). If a file with the same name already exists its contents are discarded and the file is treated as a new empty file. |
Definition at line 34 of file ev3cxx_file.h.
References File::open().
|
inlinevirtual |
Close the file if is open.
Reimplemented in Bluetooth.
Definition at line 81 of file ev3cxx_file.h.
References File::isOpen(), and File::m_filedesc.
Referenced by File::~File().
|
inlinevirtual |
Return if is file open.
Reimplemented in Bluetooth.
Definition at line 72 of file ev3cxx_file.h.
References File::m_filedesc.
Referenced by File::close().
|
inlinevirtual |
Return file descriptor to open file or NULL.
filename | Path to file. |
mode | Mode in which will be file open. More info http://www.cplusplus.com/reference/cstdio/fopen/ Default mode is "w+": Create an empty file and open it for update (both for input and output). If a file with the same name already exists its contents are discarded and the file is treated as a new empty file. |
Reimplemented in Bluetooth.
Definition at line 63 of file ev3cxx_file.h.
References File::m_filedesc.
Referenced by File::File().
|
inline |
Read character from file.
Definition at line 109 of file ev3cxx_file.h.
References File::m_filedesc.
|
inline |
Read number from file.
Definition at line 124 of file ev3cxx_file.h.
References File::m_filedesc.
|
inline |
Set position of stream to the beginning.
Vraper around standard function rewind(). Sets the position indicator associated with stream to the beginning of the file.
Definition at line 147 of file ev3cxx_file.h.
References File::m_filedesc.
|
inline |
Write character to file.
Definition at line 97 of file ev3cxx_file.h.
References File::m_filedesc.