39 FILE* 
File::Open(
const std::string& filename, 
const std::string& mode) {
    40   return fopen(filename.c_str(), mode.c_str());
    44                       const std::string& mode) {
    45   FILE* stream = fopen(filename.c_str(), mode.c_str());
    46   if (stream == 
nullptr) {
    47     tprintf(
"Unable to open '%s' in mode '%s'\n", filename.c_str(),
    54                                   const std::string& filename) {
    55   FILE* stream = fopen(filename.c_str(), 
"wb");
    56   if (stream == 
nullptr) {
    57     tprintf(
"Unable to open '%s' for writing\n", filename.c_str());
    60   fputs(str.c_str(), stream);
    65   FILE* stream = fopen(filename.c_str(), 
"rb");
    66   if (stream == 
nullptr) {
    74   FILE* stream = 
File::Open(filename.c_str(), 
"rb");
    75   if (stream == 
nullptr) 
return false;
    82 std::string 
File::JoinPath(
const std::string& prefix, 
const std::string& suffix) {
    83   return (prefix.empty() || prefix[prefix.size() - 1] == 
'/')
    85              : prefix + 
"/" + suffix;
    89   const int status = unlink(pathname);
    91     tprintf(
"ERROR: Unable to delete file %s\n", pathname);
   101  HANDLE handle = FindFirstFile(pattern, &data);
   102  bool all_deleted = 
true;
   103  if (handle != INVALID_HANDLE_VALUE) {
   104    for (; result; result = FindNextFile(handle, &data)) {
   115   bool all_deleted = 
true;
   116   if (glob(pattern, 0, 
nullptr, &pglob) == 0) {
   117     for (paths = pglob.gl_pathv; *paths != 
nullptr; paths++) {
   131     fseek(stream_, 0, SEEK_END);
   132     filesize_ = ftell(stream_);
   133     fseek(stream_, 0, SEEK_SET);
   138     fseek(stream_, 0, SEEK_END);
   139     filesize_ = ftell(stream_);
   140     fseek(stream_, 0, SEEK_SET);
   144   if (stream_ != 
nullptr) {
   150   char buf[BUFSIZ + 1];
   152   while ((l = fread(buf, 1, BUFSIZ, stream_)) > 0) {
   153     if (ferror(stream_)) {
   164   int ret = fclose(stream_);
   182   if (stream_ != 
nullptr) {
   188   fputs(str.c_str(), stream_);
   192   int ret = fclose(stream_);
 static bool DeleteMatchingFiles(const char *pattern)
InputBuffer(FILE *stream)
static bool ReadFileToString(const std::string &filename, std::string *out)
static FILE * OpenOrDie(const std::string &filename, const std::string &mode)
void WriteString(const std::string &str)
static bool Delete(const char *pathname)
static void WriteStringToFileOrDie(const std::string &str, const std::string &filename)
static bool Readable(const std::string &filename)
DLLSYM void tprintf(const char *format,...)
static std::string JoinPath(const std::string &prefix, const std::string &suffix)
bool Read(std::string *out)
OutputBuffer(FILE *stream)
static FILE * Open(const std::string &filename, const std::string &mode)