Created read method on MString to read from sockets.

This commit is contained in:
Brad Arant committed 2024-07-09 12:56:10 -07:00
1 parent cca957b948
commit 7341d26852
3 files changed
+16 -1

No files matched your search

+9
View File
@@ -6,6 +6,8 @@
#include <format>
#include <iomanip>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
namespace coreutils {
@@ -247,6 +249,13 @@ namespace coreutils {
}
length = size;
}
MString &MString::read(int fd) {
char ch;
while(::read(fd, &ch, 1))
write(ch);
return *this;
}
int MString::offset() {
return cursor - data;