This is getting weirder and weirder!
0xA5, the byte, is decimal 165. You posted above that the text file shows “16512345”, which makes no sense as you appear to be seeing the textual/ascii representation of the byte and the int. We should be seeing the binary/internal representation.
Reading it back should be the same as what was written. 0xA5, and 12345.
0x49 is 73 decimal and nothing like 0xA5. 84208586 is defintely not 12345 either. This is bugging me now! I’m considering getting hold of an SD card interface and debugging this problem. Problem is it takes ages for deliveries to arrive in the wilds of Yorkshire!
I’m a bit stumped now.
Maybe we need to write a linefeed between the two values when we are writing?
I’ll have a think.
Cheers,
Norm.