MCPcopy Create free account
hub / github.com/davisking/dlib / get_file_size

Function get_file_size

examples/slm_advanced_train_ex.cpp:446–453  ·  view source on GitHub ↗

Utility function to get file size

Source from the content-addressed store, hash-verified

444
445// Utility function to get file size
446size_t get_file_size(const std::string& filepath) {
447 std::ifstream file(filepath, std::ios::binary);
448 if (!file) return 0;
449 file.seekg(0, std::ios::end);
450 size_t file_size = file.tellg();
451 file.close();
452 return file_size;
453}
454
455// Function to generate tokens filename based on input file and size
456std::string generate_tokens_filename(const std::string& input_file, size_t max_bytes) {

Callers 2

read_enwikiFunction · 0.85
mainFunction · 0.85

Calls 2

seekgMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected