MCPcopy Create free account
hub / github.com/apple/foundationdb / fileSize

Function fileSize

flow/Platform.actor.cpp:2931–2947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2929}
2930
2931int64_t fileSize(std::string const& filename) {
2932#ifdef _WIN32
2933 struct _stati64 file_status;
2934 if (_stati64(filename.c_str(), &file_status) != 0)
2935 return 0;
2936 else
2937 return file_status.st_size;
2938#elif (defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__))
2939 struct stat file_status;
2940 if (stat(filename.c_str(), &file_status) != 0)
2941 return 0;
2942 else
2943 return file_status.st_size;
2944#else
2945#error Port me!
2946#endif
2947}
2948
2949size_t readFileBytes(std::string const& filename, uint8_t* buff, size_t len) {
2950 std::fstream ifs(filename, std::fstream::in | std::fstream::binary);

Callers 4

readFileBytesFunction · 0.85
cleanupTraceFilesMethod · 0.85
loadPublicKeyFileMethod · 0.85

Calls 3

_stati64Class · 0.85
statClass · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected