// C String.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<cstring>
int main(int argc, char* argv[])
{
using namespace std;
char arrstr[1024] ;
ifstream in;
ofstream out;
in.open ("studentInfo.txt");
out.open ("studentInfo1.txt");
if(in.fail())
{
cout<<"open file failed";
exit(1);
}
if(out.fail())
{
cout<<"open file failed";
exit(1);
}
int i = 0;
while( !in.eof() )
{
in.getline(arrstr,1024);
out<<arrstr<<endl;
i++;
}
cout<<i<<endl;
return 0;
}
最后输出读取的行数