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

📄 io20_8.01.c

📁 C++ Primer的第三版结合了Stanley Lippman的实践经验和Josée Lajoie对于ANSI/ISO标准C++的深入理解。这本指导书的第三版已经被重新改写过
💻 C
字号:
#include <string>
#include <fstream>
#include <sstream>

/**
 ** note: no available sstream implementation
 **       available at this time -- code has not
 **       been exercised
 **
 **/

string read_file_into_string()
{
	ifstream ifile( "alice_emma" );
	ostringstream buf;
	char ch;
	while ( buf && ifile.get( ch ))
 	        buf.put( ch );
	return buf.str();
}

int main()
{
	string text = read_file_into_string();

	// marks the position of each newline within text
	vector< string::size_type > lines_of_text;

	string::size_type pos = 0;
	while ( pos != string::npos )
	{
		pos = text.find( 'n' pos );
		lines_of_text.push_back( pos );
	}

	// ...
}





⌨️ 快捷键说明

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