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. ...
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!
I figured it out. I didn't realise that you can check for each jpeg at the start of each 512 block, so I just had to make a small adjustment to the code and it worked (the finding first jpeg, at least).