⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch12.4.03.c

📁 适合中高级学习的人参考使用的c++程序代码
💻 C
字号:
#include <string>
#include <algorithm>
#include <iterator>
#include <fstream.h>
// #include <fstream>

/**
 **
 stanl@john:d.12 355 : xsh32 ch12.4.03.c

 stanl@john:d.12 356 : a.out
 please enter a file to open: infile
 ineluctable modality of the visible ... stanl@john:d.12 357 : 

 stanl@john:d.12 357 : cat infile
 ineluctable modality of the visible ...
 **
 **/

main()
{
	string file_name;

	cout << "please enter a file to open: ";
	cin >> file_name;

	if ( file_name.empty() || !cin ) {
		cerr << "unable to read file name\n"; return -1;
	}

	ifstream infile( file_name.c_str());
	if ( !infile ) {
		cerr << "unable to open " << file_name << endl;
		return -2;
	}

	istream_iterator< string > ins( infile ), eos;
	ostream_iterator< string > outs( cout, " " );
	copy( ins, eos, outs );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -