Conversion

  • Thread starter Thread starter JK
  • Start date Start date
J

JK

How would I convert something like below to c# or VB.Net.

unsigned char ar[] = "AB";
unsigned int i = 0;
i = *(unsigned int *)ar;

Thanks
JK
 
How would I convert something like below to c# or VB.Net.
unsigned char ar[] = "AB";
unsigned int i = 0;
i = *(unsigned int *)ar;

Well if it's the end result you want then you can simply do

Dim i As Integer = &H4241

As a bonus you get rid of the bug in the original code, which is a
perfect example of how you can shoot yourself in the foot if you don't
use pointers carefully.


Mattias
 
Back
Top