19 Binstream(
const std::string,
const char*);
26 void open(
const std::string,
const char*);
28 operator bool()
const;
47 const int size =
sizeof(
T);
51 "cannot read from an unopened file.");
53 size_t ch = fread(&data, size, 1, this->
fileptr);
57 "Some data couldn't be read. Please make sure you are using op: \"r\".");
66 const int size =
sizeof(
T);
70 "cannot write to an unopened file.");
72 size_t ch = fwrite(&data, size, 1, this->
fileptr);
76 if(ch < 1 || fflush(this->
fileptr) != 0)
79 "Some data couldn't be written.");
88 const int size =
sizeof(
T);
92 "cannot read from an unopened file.");
94 size_t ch = fread(data, size, n, this->
fileptr);
95 if(ch <
static_cast<size_t>(n))
98 "Some array elements couldn't be read. Please make sure you are using op: \"r\".");
107 const int size =
sizeof(
T);
111 "cannot write to an unopened file.");
113 size_t ch = fwrite(data, size, n, this->
fileptr);
117 if(ch <
static_cast<size_t>(n) || fflush(this->
fileptr) != 0)
120 "Some array elements couldn't be written.");
Binstream & write(const T *data, const int n)
Definition binstream.h:105
void open(const std::string, const char *)
Definition binstream.cpp:73
Binstream & operator>>(T &data)
Definition binstream.h:45
bool operator!() const
Definition binstream.cpp:83
~Binstream()
Definition binstream.cpp:37
Binstream & operator=(const Binstream &)=delete
Binstream(const Binstream &)=delete
Binstream & read(T *data, const int n)
Definition binstream.h:86
FILE * fileptr
Definition binstream.h:24
Binstream & operator<<(const T &data)
Definition binstream.h:64
void close()
Definition binstream.cpp:54
#define T
Definition exp.cpp:237
void WARNING_QUIT(const std::string &, const std::string &)
Combine the functions of WARNING and QUIT.
Definition test_delley.cpp:15