5 #include "gb/utils/fileutils.h" 8 void InitFile(
const std::string &path,
void *buffer, size_t len) {
9 const char *filename = path.c_str();
10 FILE *f = fopen(filename,
"w+");
11 if (buffer !=
nullptr && len > 0) {
13 printf(
"Unable to open \"%s\".\n", filename);
16 fwrite(buffer, len, 1, f);
18 chmod(filename, 00660);
22 void EmptyFile(
const std::string &path) { InitFile(path); }
void InitFile(const std::string &path, void *buffer=nullptr, size_t length=0)
void EmptyFile(const std::string &path)