无法使用boost文件系统读取文件中的行

时间:2011-12-29 18:52:00

标签: c++ boost

我有一个包含以下内容的cpp文件:

#include <QApplication>

int/**/ main(int /*c*/,char**v)
{/*

*/
    QApplication app(c,v);//
//
    return app.exec();

/**/

}

我打开这个文件:

boost::filesystem3::path file("C:\\Users\\Art\\Desktop\\six_lines.txt");
boost::filesystem3::ifstream fin(file);

    if (fin)
    {
        std::string read_line;
        while (getline(fin,read_line))//here I'd hope to read just one line
        {


        }
    }  

不幸的是,getline(fin,read_line)只执行一次(文件存在)。为什么呢?

0 个答案:

没有答案