34 File(
const char * filename,
const char * mode =
"w+") {
63 virtual bool_t
open(
const char * filename,
const char * mode =
"w+") {
64 return ((
m_filedesc = fopen(filename, mode)) != NULL);
122 template <
typename T>
123 typename std::enable_if<std::is_integral<T>::value,
int>::type
127 int er = fscanf(
m_filedesc,
"%lld", &integral);
132 template <
typename T>
133 typename std::enable_if<std::is_floating_point<T>::value,
int>::type
136 double floating_point;
137 int er = fscanf(
m_filedesc,
"%lf", &floating_point);
138 val = floating_point;
int write(char ch)
Write character to file.
virtual bool_t isOpen()
Return if is file open.
virtual bool_t open(const char *filename, const char *mode="w+")
Return file descriptor to open file or NULL.
File(const char *filename, const char *mode="w+")
Constructor of class File.
FILE * m_filedesc
file of this class
int readChar()
Read character from file.
std::enable_if< std::is_integral< T >::value, int >::type readNumber(T &val)
Read number from file.
virtual ~File()
Destructor of class File. Close the file if is open.
Class File. API for working with file.
void rewind()
Set position of stream to the beginning.
FILE * operator()()
Return file descriptor to open file or NULL.
virtual int close()
Close the file if is open.