本文介绍了请帮我解决这个问题...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include<iostream>
#include<fstream>
#include<conio.h>

using namespace std;

int main()
{
	char InFile[80]; 
	char ch;
	
	ifstream InStream;

	cout<<"Enter input file name: " ;
	cin>>InFile;

	//open the file
	// in.open(fin); 
	InStream.open(InFile, ios::in);

	// check the file
	if(!InStream)
	{
		cout << "Error open file " << InFile << endl;
	getch();
		//system("pause");
	}
	
	cout << "Here is the content of " << InFile << ": ";
	while (!InStream.eof()) {
		//Read each character.
		InStream.get(ch);    

		// make sure we don''t write any odd characters on screen
		if (!InStream.eof()) 
		{
			cout << ch;  //Write to screen
		getch();
        //	system("pause");
		}
	}

	InStream.close();
}





------------
问题是,是的,文件中的内容会显示出来,但是在我输入后会逐个字母地显示..请帮助我解决这个问题..





------------
the problem is that,yes the content in the file will shown up but letter by letter evrey after i entered..please help me to fix with this ..

推荐答案


这篇关于请帮我解决这个问题...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 02:22