version 2.0.0_prealpha
PIFile::put() and get()
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -145,6 +145,10 @@ public:
|
||||
|
||||
//! Set float numbers write precision to "prec_" digits
|
||||
void setPrecision(int prec);
|
||||
|
||||
PIFile & put(const PIByteArray & v);
|
||||
|
||||
PIByteArray get();
|
||||
|
||||
|
||||
//! Write to file binary content of "v"
|
||||
|
||||
Reference in New Issue
Block a user