Re: Integer conversion to Binary Coded Decimal
- From: Kenney <Kenney@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Jan 2009 06:25:01 -0800
At the moment I seem to be doing the following:
int ------> string
string ----> char []
foreach (char c in char [])
{
c -------> byte
byte ----> binary string
binary string -----> string []
}
then combine the items in the string [] into 8 character strings and convert
to hex. I am getting the conversion but it seems like a lot of work for
something I thought the framework would provide.
Any thoughts?
"Stefan L" wrote:
Hmmm....
What exactly do you mean with a smart way? Whether there's a function in
the framework doing it for you? I guess ... no. But I'm not sure here.
On the other hand: Why worrying about a function that requires 10 lines
of code?
regards,
Stefan
Kenney schrieb:
Hi All,
I work with communications protocols (namely TCPIP) and I have been asked to
transmit the length of a message in Binary Coded Decimal. For example a
message of length (int) 356 will be transmitted as 0x03, 0x56.
Is there a smart way to to this?
Cheers,
Kenney
- Follow-Ups:
- Re: Integer conversion to Binary Coded Decimal
- From: Stefan L
- Re: Integer conversion to Binary Coded Decimal
- References:
- Integer conversion to Binary Coded Decimal
- From: Kenney
- Re: Integer conversion to Binary Coded Decimal
- From: Stefan L
- Integer conversion to Binary Coded Decimal
- Prev by Date: Re: Predicates
- Next by Date: Is there a better way of doing it?
- Previous by thread: Re: Integer conversion to Binary Coded Decimal
- Next by thread: Re: Integer conversion to Binary Coded Decimal
- Index(es):
Relevant Pages
|