Solved

Convert C Code to VB6

Posted on 2008-06-23
3
277 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now