Solved

Convert C Code to VB6

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Login 17 48
Error in script 11 55
PrintingFoundIt(Almost!(Damn!)) 1 26
Printing 1 50
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

813 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

15 Experts available now in Live!

Get 1:1 Help Now