Explorar o código

readall(string&)

ithewei %!s(int64=6) %!d(string=hai) anos
pai
achega
0ef2847ff3
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      hfile.h

+ 6 - 0
hfile.h

@@ -55,6 +55,12 @@ class HFile {
         return fread(buf.base, 1, buf.len, _fp);
     }
 
+    size_t readall(string& str) {
+        size_t filesize = size();
+        str.resize(filesize);
+        return fread((void*)str.data(), 1, filesize, _fp);
+    }
+
     bool readline(string& str) {
         str.clear();
         char ch;