Sychronize JPEG camera and SD card

A JPEG should start with 0xFF 0xD8, I think.

That's also right. After some research, I found out that that's the "magic number" of the .jpg files, and I tried to "force" the future files to begin with this number, by writing it into each file before the foto translation and transport. But I got another error message...
However, I attach to this post the TEXT.txt file so you can read it and eventually fix it; I'd be infinitely thankful.

TEST.txt (12.3 KB)