请前辈帮我看一下我这个程序为什么读不了文件里的内容,谢谢!
学生管理系统源文件.rar
(7.59 KB)
string fn = "ReadMe.txt"; ifstream fin(fn.c_str(), ios_base::in); if(!fin.is_open()) { cerr<<"can't open "<<fn<<endl; exit(EXIT_FAILURE); } char buf[1024]; int readSize = 0; while (!fin.eof()) { memset(buf, 0, sizeof(buf)); fin.getline(buf, sizeof(buf)); cout << buf << endl; } fin.close();