#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
ifstream fin;
fin.open("D://workspace//gt.txt");//经过验证两种打开方式均可得到正确输出
fin.open("D:\\workspace\\gt.txt");
string line;
getline(fin, line);
cout << line << endl;
return 0;
}
两种方式的输出是一样的,如下所示: