append Byte to file, but I have an integer

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

append Byte to file, but I have an integer

Post by stefan.erni »

Hi
I need to append an integer to the FAT1
Can I just use appendBytetoFile and put there my 16Bit Integer and FAT1 will write all 16 bit (in 2Byte)?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: append Byte to file, but I have an integer

Post by Benj »

Hello,

You will need to store the two bytes of the 16-bit value separately.

AppendByteToFile ( IntVar ) //Store Lower 8-bits
AppendByteToFile ( IntVar >> 8 ) //Store Upper 8-bits

Post Reply