Hello! I’m trying to copy a picture byte-by-bye, almost it turns out ... In the output image file, an offset occurs ... Well, bytes 00 00 cc aa ss go, and at the output 00 is added somewhere and 00 00 00 cs aa cc is obtained. Where does he come from? I put checkpoints in the character buffer, everything seems to be correctly entered ...
Here is a piece of code:
unsigned char ch[1000000]; int hight, wight; FILE *stream,*stream3; stream = fopen("w.bmp", "rb"); stream3 = fopen("file2.bmp","w"); if ((stream==NULL)||(stream3==NULL)){ cout << "Can't open file!\n"; } int i=0; while(!feof(stream)){ //putc(ch[i]=getc(stream),stream3); ch[i]=getc(stream);//В массив всё!!! i++; } i-=2;//Всё верно!!! int counter=i; fseek(stream3,0,SEEK_SET);// в начало файла//54-начало файла ставим 0 int y=0; while(y<=counter){ putc(ch[y],stream3);//Вроде как не работает... y++; } Вод фрагмент из winhex: do: posle 38 c4 38 00 39 ab 39 c4 40 .. 40 ab
And another thing, the studio sometimes said stakc overflow ... What is this error ???