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

📄 finput.h

📁 本人自己编写的用于文本编辑开发的小软件
💻 H
字号:
#ifndef FINPUT_H
#define FINPUT_H
void Finput()	//从文件读入文本
{
	v.clear();
	system("cls");
	cout<<"请输入文件名,将打开以.lhs为后缀的文件:";

	string temp;

	cin>>temp;
	temp=temp+".lhs";//添加后缀
	fstream fin(temp.c_str(),ios::in);
	if(!fin)
	{
		cout<<"文件打开失败或文件不存在!"<<endl;
		system("pause");
	}
	else
	{
		fin>>LineNum;
		fin.ignore();
		for(int i=0;i<LineNum;i++)//将文件中的文本读入到内存中去
		{
			string str;
			getline(fin,str);
			Line * tp=new Line;
			tp->length=str.size();
			tp->s=str;
			v.push_back(tp);
		}
		fin.close();
		cout<<"文件"<<temp<<"打开成功!"<<endl;//打开成功提示
		system("pause");
	}
}
#endif			

⌨️ 快捷键说明

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