#include<fstream>
#include<iostream>
#include<iomanip>
using namespace std;
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
char a[28];
int i =0;
ifstream ifile; //说明输入文件流对象ifile
ofstream ofile; //说明输出文件流对象ofile
ifile.open( "d:\\my_in_file.txt" );
ofile.open( "d:\\my_out_file.txt" );
ifstream ifile( "d:\\my_in_file.txt" ); //说明输入文件流对象ifile并打开文件
ofstream ofile( "d:\\my_out_file.txt" );//说明输出文件流对象ofile并打开文件
oflie<<"输出的信息"<<endl;
if (!ifile)//判断文件是否存在;
{
printf("没有找到相应的文件");
ifile.close();
system("pause");
return 0;
}
while (1)
{
while (ifile.get(a[i]))
{
if (a[i] == '\n')break;
i++;
}
a[i] = '\0';
printf("%s\n", a);
i = 0;
if (ifile.eof()!=0)
{
break;
}
}
ifile.close();
return 0;
}
只是作为一个简单的记忆,算作是在前辈中copy过来的,具体的关键词都有了,主要的就是在实际运用过程中怎么去熟练掌握住这类的知识;