#include <fstream.h>
#include <stdlib.h>
int main()
{
ifstream in_file;
in_file.open("prices.dat"); // open the file with the external name prices.dat
if (in_file.fail()) // check for successful open
{
cout << "\nThe file was not successfully opened"
<< "\n Please check that the file currently exists." << endl;
exit(1);
}
cout << "\nThe file has been successfully opened for reading.\n";
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: ntumcc66.mba.ntu.edu.tw