#include <iostream>
#include <fstream>

long long getFileSize(const std::string& filePath) {
    std::ifstream file(filePath, std::ios::binary | std::ios::ate);
    if (!file) {
        std::cerr << "无法打开文件:" << filePath << std::endl;
        return -1;
    }
    std::streampos size = file.tellg();
    file.close();
    return size;
}

//调用
int main() {
    std::string filePath = "your_file_path_here";
    long long fileSize = getFileSize(filePath);
    if (fileSize!= -1) {
        std::cout << "文件大小为:" << fileSize << " 字节。" << std::endl;
    }
    return 0;
}