#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;
}