How do I do this

ok
a0 is fstream input file
a1 is fstream input/output file
a2 is fstream input/output file

What i need help with is this

a1 is has E9 99 9D B9. What I wanna do is put a1 back (x3 in this case) temporarily and copy it to a2, then copy a2 byte by byte into a1 looping it x3. So the end result of a1 would be

E9 99 9D B9 E9 99 9D.

I've tried unget, looping it x3 but the copied value is FF FF FF FF.

Thanks in advance
Source code pls
Never mind I got it to work by adding a2.put(CompByte1); here the code

#include <iostream>
#include <fstream>
using namespace std;

// Global Variables

fstream a0("Art.bin", ios::in | ios::binary);
fstream a1("ArtDec.bin", ios::out | ios::binary);
fstream a2("ArtDec1.bin", ios::out | ios::binary);
unsigned short d3 = 3;
unsigned short d4 = 3;
unsigned short d5 = 3;
unsigned short CompByte1;

////////////////////////////////////////////////////////////////
int main(){
do{
CompByte1 = a0.get();
a1.put(CompByte1);
a2.put(CompByte1); //// Just added this and it works
d3--;
}while(d3!=0);
do{
a2.unget();
d4--;
}while(d4!=0);
do{
CompByte1 = a2.get();
a1.put(CompByte1);
d5--;
}while(d5!=0);

a1.close();
}
i am not sure but there is something ..

reinterperate_cast


for binary fileng
Topic archived. No new replies allowed.