How to convert c code to vb.net? -


how can convert following vb? mean?

unsigned char *s = (unsigned char *)(void *)serialnum;   

from little know vb, i'm not sure there translation.

it looks intent of code take integer value (serialnum) , use address of sequence of bytes (s).

unsigned char *s declares s pointer unsigned char; value stored in s address of single byte or first byte of sequence.

(unsigned char *) , (void *) cast operations; used convert type of expression different type. c's type rules such cannot assign integer value pointer variable directly; integer value must converted pointer type using cast operation. (void *) serialnum converts type of expression serialnum int (or whatever) void *, c's idea of "generic" pointer. (unsigned char *) converts result of previous expression pointer unsigned char.

the (void *) cast operation redundant imo, , following should work well:

unsigned char *s = (unsigned char *) serialnum; 

again, don't know appropriate translation in vb be.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -