This is the biggest problem in the code, and a very common error. I stopped looking once I found this. Look at this code:
// check if reach ennd of memory card
while( fread(bytes, sizeof(bytes), 1, input) > 0)
// read 1 block from card
fread(bytes, sizeof(bytes), 1, input);
This is doing two sequential reads. The second one overwrites the ...
You need to use double quotes, not single quotes. 'w' is understood by the compiler as the char w, while "w" is understood as "write-mode". (Remember that chars also have an integer value that the compiler can convert them to, which is why it is calling this an integer error.) So, change the quote type and that should clear up the error. ...
Very interesting! Did you notice that in the two failing cases, all of the pixels on the right and bottom edges are incorrect?
So, that says there's something wrong with the code that handles those two edges.
Now, look at the relevant code for the lower right pixel. Remember that an array declared as array has valid elements from 0 to 9, not 10.
In case anyone wanted to know...
Debug50 started working again and I figured out I didn't need the second clause for buffer to buffer. The first one took care of everything, the second one put me in an infinite loop.
All is working now!