Tribal-Tec wrote in message
<11**********************@g44g2000cwa.googlegroups .com>...
The modern cpp way would be the use of fstream;
std::ofstream myFile; // or fstream for both writing and reading
myFile.open( "filename", std::ios_base::binary | std::ios_base::out );
now with seekg method you can place the write cursor to modify your
desired byte.
The 'g' in 'seekg' means 'get' to me. Use 'seekp' to 'put'.
std::ofstream MyFile("MyFile.txt", std::ios_base::binary );
if(!MyFile){ std::cout<<"\n ofstream FAILED"<<std::endl; /*exit(1);*/}
std::cout<<"ofstream MyFile.tellp() = "<<MyFile.tellp()<<std::endl;
MyFile.seekp(10, std::ios::end);
std::cout<<"MyFile.seekp(10, end) MyFile.tellp() ="
<<MyFile.tellp()<<std::endl;
MyFile.seekp(10, std::ios::beg);
std::cout<<"MyFile.seekp(10, beg) MyFile.tellp() ="
<<MyFile.tellp()<<std::endl;
MyFile.close();
--
Bob R
POVrookie