5

I want to convert an int to a byte[4] array using BCD.

The int in question will come from an device id and his needed to speak to an device via serialport.

Is there any pre-made function that does this or can you give me a simple way of doing this?

example:

int id= 29068082

would output:

byte[4]{0x82, 0x80, 0x06, 0x29};
Jeff LaFay
  • 12,882
  • 13
  • 71
  • 101
Kingpin
  • 1,067
  • 2
  • 14
  • 34
  • 1
    Related question: http://stackoverflow.com/q/2448303/87698. Apparently, there's no built-in BCD support in the .net Framework. – Heinzi Aug 18 '11 at 12:40

0 Answers0