0
텍스트 파일 인 파일을 열려고합니다.파일을 열 수 없습니다.
문자열과 fstream을 포함 시켰습니다.
#include <string>
#include <fstream>
이것은 프로그램에있는 코드이지만 프로그램을 실행할 때마다 "파일을 열 수 없습니다"라고 표시됩니다.
float unscreen()
{
cout << "Welcome to the screen help area" << endl;
cout << "\n" << endl;
string line;
ifstream myfile("unsreen.txt");
if(myfile.is_open())
{
while(getline(myfile, line))
{
cout << line << '\n';
}
myfile.close();
}
else cout << "unable to open file";
cout << "\n" << endl;
cout << "Press 0 for further action or press 9 to exit." << endl;
파일에서 뭔가를 변경해야하나요, 해당 파일이 디렉토리에 있습니다.
파일의 이름이'unscreen.txt'가 아닌'unsreen.txt'입니까? 당신의 이름은 나중에 =를 나타내는 것 같습니다.) – Cyclonecode
예, 전 선생님이 있습니다. –
파일을 열 수있는 또 다른 해결책을 찾으러 갈 것입니다. –