c++ 中获取文件长度的示例

/**
// 代码片段
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
*/
ifstream fina;
fina.open(
"test.txt");
fina.seekg(
0,ios::end);
int endI = fina.tellg();
fina.seekg(
0,ios::beg);
int beginI = fina.tellg();
int size = endI - beginI;

 

posted @ 2010-11-11 15:11  vily_雷  阅读(308)  评论(0编辑  收藏  举报