lundi 2 mars 2015

wchar_t* to short int conversion

One of the function in a 3rd party class return awchar_t* that holding a resource id (I don't know why it uses wchar_t* type ) I need to convert this pointer to short int


This method, using AND operator works for me. but it seems like not the correct way. is there any proper way to do this?



wchar_t s;
short int b = (unsigned long)(s) & 0xFFFF;

Aucun commentaire:

Enregistrer un commentaire