-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.cc
30 lines (25 loc) · 816 Bytes
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <cstdio>
#include <filesystem>
namespace {
void PrintFileContents(const std::filesystem::path path) {
printf("File contents:\n");
size_t bytes_read = 0;
char buf[256];
FILE* f = fopen(path.string().c_str(), "r");
if (f == nullptr) {
throw std::invalid_argument("Failed to open file " + path.string());
}
while ((bytes_read = fread(buf, 1, sizeof(buf), f)) > 0) {
fwrite(buf, 1, bytes_read, stdout);
printf("\n");
}
fclose(f);
}
} // namespace
int main() {
PrintFileContents("external/archive_gcloud_gz/cloud_archive_test.txt");
PrintFileContents("external/archive_gcloud_zstd/dir2/dir3/text3.txt");
PrintFileContents("external/archive_gcloud_zstd_strip2/dir3/text3.txt");
PrintFileContents("external/archive_gcloud_zstd_patch/dir2/dir3/text3.txt");
return 0;
}