![]() |
![]() |
![]() |
![]() |
![]() |
|
When opening a file for reading, you should check to see whether the file was opened successfully. To check, you can take advantage of the fact that an unsuccessful attempt to open a file causes the value of the stream variable to be 0.
if (!car_stream) {
cerr << "No such file." << endl;
return 0;
}