Solved

Convert C Code to VB6

Posted on 2008-06-23
3
284 Views
Last Modified: 2008-06-30
I got this code and was told this is how i need to convert it to readable data. I'm trying to find a way to convert the following to be used in vb6 and this is a sample string to decode 9318BC38..


1) Convert the number to IEEE.
2) Shift the highest 9 bit to the left 1 place, wrapping around.
 
Here's the C code:
 
int[] IEEEArray = BitConverter.GetBytes(myNumber));
 
//Shift most signifigant 9 bits to the left wrapping around.
//These are the high bytes because its little endian.
byte old3 = IEEEArray [3];
IEEEArray [3] = (byte)((IEEEArray [3] << 1) | (IEEEArray [2] >> 7));
IEEEArray [2] = (byte)(IEEEArray [2] | (old3 & 0x80));
 
return (IEEEArray);
0
Comment
Question by:thaburner
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 21870194
See if this helps:

Function i3efp(num_in) 'convert a decimal number to IEEE floating point (32 bit; 8 hex characters) hex string
Function i3e2d(hstr)   ' And, of course, convert a 32-bit IEEE-formatted hex string to a decimal numbe
 
http://www.tek-tips.com/faqs.cfm?fid=6404
0
 

Author Comment

by:thaburner
ID: 21870569
Thanks, It will take me a little while to test the code to see how it works....
0
 

Author Comment

by:thaburner
ID: 21899561
Thanks for you help but I'm going to just compile into into a C dll and use that in VB, that should make simplify things.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why use this lambda? 12 68
create dataset from text files to go on winforms gridview 3 26
Need help with a query 14 40
Nested forach loop to linq 3 30
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question