【发布时间】:2009-11-12 02:33:57
【问题描述】:
// stream from file.
ifstream file;
int main (int argc, char * argv[]) {
// get argument passed from command line
// This is file name
if (argc != 2 ) {
cout << "use: ./executable <filename>";
}else {
//cout << "You are using filename: " << argv[1];
// start the file stream
file (argv[1]);
}
file(argv[1]) 有什么原因会出错吗?我可以将 ifstream 作为全局变量吗?
【问题讨论】: