fix install component of BC include symlinks
[awesomized/libmemcached] / test / lib / common.hpp
index 8942a729c35f67c0d6f7e43d34b6bee92d4f1520..083efe0d66f060eaa2f4dd2baa2e7de7efc6659a 100644 (file)
@@ -16,6 +16,7 @@
 #pragma once
 
 #include <chrono>
+#include <cstring>
 #include <iostream>
 #include <map>
 #include <optional>
@@ -90,6 +91,17 @@ public:
   bool put(const char *buf, size_t len) const {
     return static_cast<ssize_t>(len) == write(fd, buf, len);
   }
+  string get() const {
+    string all;
+    char buf[200];
+    ssize_t len;
+
+    lseek(fd, 0, SEEK_SET);
+    while (0 < (len = read(fd, buf, sizeof(buf)))) {
+      all.append(buf, len);
+    }
+    return all;
+  }
 
 private:
   char fn[80];