第十六周项目 阅读程序(7)

来源:互联网 发布:java身份证正则表达式 编辑:程序博客网 时间:2024/05/21 11:54
<pre name="code" class="cpp">/* *Copyright(c) 2016, 烟台大学计算机与控制工程学院 *All rights reserved. *文件名称:main.cpp *作    者:李德坤 *完成日期:2016年6月11日 *版本号:v1.0 * *问题描述:程序阅读(7) *输入描述:无 *输出描述:无 */#include<iostream>#include <fstream>using namespace std;const char * filename = "a.txt";int main (){    long l,m;    ifstream file (filename, ios::in|ios::binary);    l = file.tellg();    file.seekg (0, ios::end);    m = file.tellg();    file.close();    cout << "size of " << filename;    cout << " is " << (m-l) << " bytes.\n";    return 0;}



0 0