zoukankan      html  css  js  c++  java
  • IO流(2)


    #include "stdafx.h"
    #include <fstream.h>
    #include <string.h>

    int main(int argc, char* argv[])
    {
        ofstream of;
       
        of.open("ofstream.txt", ios::out | ios::binary);
       
        if ( !of.fail())
        {
            of << 10;
            of.close();
        }
       
        char szBuff[256] = {0};
        ifstream ifile;
       
        ifile.open("readme.txt");
       
        if (!ifile.fail())
        {
            while (!ifile.eof())
            {
                memset(szBuff, 0, sizeof(szBuff));
                ifile.read(szBuff, sizeof(szBuff) - sizeof(char));
                cout << szBuff << flush;
            }
            ifile.close();
        }
       
        ofstream ofile1;
       
        ofile1.open("ofstream2.txt", ios::ate);
       
        if ( !ofile1.fail() )
        {
            ofile1.seekp(6, ios::beg);
            ofile1.write("WOLRD", strlen("WOLRD"));
            ofile1.close();
        }
        return 0;
    }

  • 相关阅读:
    sqli29-32环境搭建(winserver)
    sqli-labs(Basic)
    SQL语句
    8月10号
    8月9号
    第五周进度报告
    8月8号
    8月7号
    8月6号
    大道至简读后感
  • 原文地址:https://www.cnblogs.com/w413133157/p/1666799.html
Copyright © 2011-2022 走看看