C++文件操作

来源:互联网 发布:2014淘宝全年销售额 编辑:程序博客网 时间:2024/06/01 08:48
string  getFileContext(const string& filename){    string str;    str.clear();    char buf[1024];    char *p;    p = buf;    memset(buf, 0, 1024);    ifstream in;    in.open(filename);    while ((*p = in.get()) != EOF)    {        p++;    }    cout << "Buf" << endl;    puts(buf);    str += buf;    cout << str << endl;    in.close();    return str;}
0 0