// testio.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {
fstream iofile ("c:\\tmp\\test.txt", ios::in | ios::out | ios::binary| ios::ate);
//doing some reading and updating.....
const char c = 'c';
char *s = new char[100];
iofile.seekg( 0, ios_base::end );
long sizeoffile = iofile.tellg();
iofile.seekg( 0, ios_base::beg );
iofile.read( s, 5 );
iofile.seekp(sizeoffile, ios_base::beg);
iofile.write((char *)&c, 1); //nothing is written. try put function. same result.
delete[] s;
return 0;
}
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) {
fstream iofile ("c:\\tmp\\test.txt", ios::in | ios::out | ios::binary| ios::ate);
//doing some reading and updating.....
const char c = 'c';
char *s = new char[100];
iofile.seekg( 0, ios_base::end );
long sizeoffile = iofile.tellg();
iofile.seekg( 0, ios_base::beg );
iofile.read( s, 5 );
iofile.seekp(sizeoffile, ios_base::beg);
iofile.write((char *)&c, 1); //nothing is written. try put function. same result.
delete[] s;
return 0;
}