The first thing I would do, is to change from
char
to
unsigned char
in case it is "losing" the top bit, and try caching the file size to save waste: you are calling the
filsz
function for each and every byte in the file, twice, as it is called each time the
for
loop needs to see if it should go round again:
int bytes = filsz();
imgs = new unsigned char[bytes];
ifstream inm("aaa.jpg",ios::in|ios::binary);
for(int i=0; i < bytes; i++)
If that doesn't sort it, then you need to look at the actual data in the file(s) to work out what is being output for what input.
PsPad[
^] has a HEX mode which would make that relatively simple (and it's not a bad editor, either if you need more complex editing than VS can provide - I don't use it much, but it can save a lot of time)
[edit]Stupid HTML... - OriginalGriff[/edit]