파일을 열어 읽을 수 있습니다.ifstream에서 파일을 열 수 없습니다.
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
ifstream input_file("blah.txt", ios::in);
ofstream output_file("output.txt", ios::out);
Bank::Bank(void){
input_file.open("blah.txt");
if(!input_file){
cerr << "Error" << endl;
exit(1);
}
else{
cout << "good 2 go" << endl;
}
}
이 파일은 blah.txt라는 파일을 읽는 데 필요한 코드이며 터미널에서 출력되는 내용은 "오류"입니다. 나는 Linux Mint 14와 gVim을 사용하고 있으므로, : pwd 명령을 입력하면, 나는/mnt/share 디렉토리에 있다는 것을 압니다. 터미널에서 확인하면 blah.txt 파일이 같은 디렉토리에 있습니다. 내가 생각할 수있는 유일한 방법은 숨겨진 파일 확장입니다. 파일을 열 수없는 이유는 무엇입니까?