?
Solved

Convert C Code to VB6

Posted on 2008-06-23
3
Medium Priority
?
303 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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!
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

807 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