天狼啸月
天狼神族
posts - 0,  comments - 0,  trackbacks - 0
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int CountLines(char *filename)
{
 ifstream ReadFile;
 int n=0;
 char line[512];
 string temp;
 ReadFile.open(filename,ios::in);
 if(ReadFile.fail())
  return 0;
 else
 {
  while(getline(ReadFile,temp))
   n++;
  return n;
 }
 ReadFile.close();
}
void main()
{
 cout<<"a.txt的行数为:"<<CountLines<<endl;
 cin.get();
}
posted on 2011-12-23 09:46 烈焰之光 阅读(140) 评论(0)  编辑 收藏 引用 所属分类: 源码文件及文件夹操作

<2026年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿

文章分类

文章档案

搜索

  •  

最新评论