| 35 | } |
| 36 | |
| 37 | void BinaryTable::SaveToFile(const std::string &filename) const { |
| 38 | FILE *fp = fopen(filename.c_str(), "wb"); |
| 39 | CHECK(fp) << "Unable to open file: " << filename; |
| 40 | if (fwrite(reinterpret_cast<const char *>(data()), 1, size(), fp) != size()) { |
| 41 | fclose(fp); |
| 42 | LOG(FATAL) << "Write file error: " << filename; |
| 43 | } |
| 44 | fclose(fp); |
| 45 | } |
| 46 | |
| 47 | void BinaryTable::AppendToFile(const std::string &filename) const { |
| 48 | FILE *fp = fopen(filename.c_str(), "ab"); |