std::ifstream 打开文件,获得文件流 并赋给std::string

    // 打开文件,获得文件流
    std::ifstream inFile(fileName.c_str(), std::ios::in | std::ios::binary);
    std::ostringstream oss;
    oss << inFile.rdbuf();
    std::string buffer = oss.str();
    inFile.close();

posted on 2011-05-20 18:32  几百人有爱  阅读(930)  评论(0编辑  收藏  举报