【发布时间】:2014-02-14 21:29:39
【问题描述】:
这是我上一个问题的延续, In C++, how to read the contents of a text file, and put it in another text file?
在那,我能够打开一个输入文件input.txt并成功读取它的内容,
但现在我不想预先硬编码或给出输入文件名,
ifstream myfile ("input.txt");
if (myfile.is_open())
但我想稍后在编译程序并在命令行中生成一个名为test的可执行文件后给出输入文件名,如下所示
./test input.txt
关于如何做到这一点的任何建议?
【问题讨论】: