ファイルを1行ずつ読みたい。のようなことをしました
void Parse (string filepath) {
ifstream sourceFile;
sourceFile.open(filepath);
for (string line; getline(sourceFile, line);) {
cout << "1" << endl;
cout << line << endl;
}
}
int main() {
Parse("C:\\test.txt");
getchar();
return 0;
}
次に、テキストを に入れますがC:\test.txt
、実行しても何も得られません。なんで?「1」すらありません。ファイルが存在しない場合でも、例外はありません。問題の兆候だと思いますか?