This commit is contained in:
Niklas Gollenstede
2025-10-31 22:37:36 +01:00
commit 174fe17e89
197 changed files with 79558 additions and 0 deletions

24
libsys/iostream.h Normal file
View File

@@ -0,0 +1,24 @@
#pragma once
#include "outputstream.h"
#include "stub.h"
class IOStream : public OutputStream {
private:
IOStream(IOStream &copy); // no copy
int fd;
public:
explicit IOStream(int sysfd = 0) : fd(sysfd) {}
~IOStream() {
if (pos > 0) {
sys_write(fd, buffer, pos);
}
}
void flush() override {
sys_write(fd, buffer, pos);
pos = 0;
}
};