can someone help me to do the following.
1) convert a Ulong into a byte array.
2) convert a byte array to an Ulong.
3) convert a Ulong into a byte array in VB
4) convert a byte array to an Ulong in VB.
on another Note,
I am a NGO sponsor for the Dewildt Cheetah Farm IN bela bela South Africa.
I also run it for Ann Van Dyk.
http://www.dewildt.co.za/index.php?opti ... &Itemid=65
this center is the leading center in the world on cheetah ,
the farm is also an un-spoilt conservation farm.
as a token of my appreciation for all the help from Flowcode Staff,
if any of the matrixmultimedia staff find them in south Africa, I would lie to offer them a week free holiday here on the farm.
Regards
Roy Johnston
Ulong conversion.
Moderator: Benj
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
- Contact:
- 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: Ulong conversion.
Hi Roy,
I can help with 1 and 2 but VB is not my strong point.
As for staying at the farm sounds like a fantastic opportunity, thanks for the offer. Unfortunately I've already booked my holiday/honeymoon to Kenya this year, knew I should have waited
1) convert a Ulong into a byte array.
There may be issues on 8-bit devices for the 16 and 24 bit shifts, in C you would perform a typecast but even this has issues. In Flowcode we have added a structure to allow you to do this but unfortunately you need to resort to using C at the moment so it won't simulate etc. We should be able to make this a supported function fairly easily, I'll add it to the list.
2) convert a byte array to an Ulong.
Again there may be issues on 8-bit devices for the 16 and 24 bit shifts so here is the C code that is known to work.
I can help with 1 and 2 but VB is not my strong point.
As for staying at the farm sounds like a fantastic opportunity, thanks for the offer. Unfortunately I've already booked my holiday/honeymoon to Kenya this year, knew I should have waited
1) convert a Ulong into a byte array.
Code: Select all
byte[0] = Long
byte[1] = Long >> 8
byte[2] = Long >> 16
byte[3] = Long >> 24
Code: Select all
MX_Union32 LongToByte;
LongToByte.AsLong = FCV_LONGVAR;
FCV_BYTE[0] = LongToByte.AsByte[0];
FCV_BYTE[1] = LongToByte.AsByte[1];
FCV_BYTE[2] = LongToByte.AsByte[2];
FCV_BYTE[3] = LongToByte.AsByte[3];
Code: Select all
Long = byte[0]
Long = Long | byte[1] << 8
Long = Long | byte[2] << 16
Long = Long | byte[3] << 24
Code: Select all
MX_Union32 LongToByte;
LongToByte.AsByte[0] = FCV_BYTE[0];
LongToByte.AsByte[1] = FCV_BYTE[1];
LongToByte.AsByte[2] = FCV_BYTE[2];
LongToByte.AsByte[3] = FCV_BYTE[3];
FCV_LONGVAR = LongToByte.AsLong;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 220
- Joined: Mon Aug 24, 2009 8:38 am
- Has thanked: 2 times
- Been thanked: 34 times
- Contact: