version 2.0.0_prealpha

PIFile::put() and get()
This commit is contained in:
2020-08-11 20:09:34 +03:00
parent 3ba6a7b0e8
commit 57a9ccb854
8 changed files with 87 additions and 5 deletions

View File

@@ -394,6 +394,25 @@ void PIFile::setPrecision(int prec) {
}
PIFile & PIFile::put(const PIByteArray & v) {
writeBinary((int)v.size_s());
write(v);
return *this;
}
PIByteArray PIFile::get() {
PIByteArray ret;
int sz(0);
read(&sz, sizeof(sz));
if (sz > 0) {
ret.resize(sz);
read(ret.data(), sz);
}
return ret;
}
PIFile &PIFile::operator <<(double v) {
if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, ("%" + prec_str + "lf").data(), v);
return *this;