第16周程序阅读(4)

来源:互联网 发布:泰格软件 编辑:程序博客网 时间:2024/05/26 20:23
#include <iostream>#include <fstream>using namespace std;int main(){    fstream outfile,infile;    outfile.open("data.txt",ios::out);    for (int i=0; i<26; i++)        outfile<<(char)('A'+i);    outfile.close();    infile.open("data.txt",ios::in);    char ch;    infile.seekg(6,ios::beg);    if(infile.get(ch))        cout<<ch;    infile.seekg(8,ios::beg);    if(infile.get(ch))        cout<<ch;    infile.seekg(-8,ios::end);    if(infile.get(ch))        cout<<ch;    cout<<endl;    infile.close();    return 0;}

0 0