diff --git a/MString.cpp b/MString.cpp index 31610b2..73fa121 100644 --- a/MString.cpp +++ b/MString.cpp @@ -278,6 +278,13 @@ namespace coreutils { write(ch); return *this; } + + MString &MString::read(int fd, int count) { + char ch; + while(count-- && ::read(fd, &ch, 1)) + write(ch); + return *this; + } int MString::offset() { return cursor - data; diff --git a/MString.h b/MString.h index c0fde6d..46f90df 100644 --- a/MString.h +++ b/MString.h @@ -231,7 +231,8 @@ namespace coreutils { /// MString &read(int fd); - + MString &read(int fd, int len); + /// /// ///