[C++] The first commit for C++ version
16 tests out of 169 are passing.
diff --git a/fileutil.cc b/fileutil.cc
new file mode 100644
index 0000000..51f080e
--- /dev/null
+++ b/fileutil.cc
@@ -0,0 +1,20 @@
+#include "fileutil.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "log.h"
+
+bool Exists(StringPiece filename) {
+ CHECK(filename.size() < PATH_MAX);
+ char buf[PATH_MAX+1];
+ memcpy(buf, filename.data(), filename.size());
+ buf[filename.size()] = 0;
+ struct stat st;
+ if (stat(buf, &st) < 0) {
+ return false;
+ }
+ return true;
+}