【发布时间】:2014-09-07 12:50:09
【问题描述】:
我正在编写一个 C++ 程序,使用 ifstream ofstream 函数。我问用户要打开哪个文件,然后问他们给文件取什么名字。请看下面的代码,帮助我弄清楚如何正确使用 append 函数。
cout << "Please type the new name for your file ( File must end in '.txt'): ";
cin>>outf; // stores name of requested txt file
if (!outf.rfind(".txt"))
{
outf.append(".txt");
}
可以使用建议....
【问题讨论】: