Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert an MFC CString to an unsigned integer

I am trying to convert a CString to an unsigned int. I have looked up and got results for conversion to unsigned long but couldn't find anything for int as such. I know this is simple, but its kind of confusing me a bit.

Any suggestions?

Need something like this:

CString abc;
unsigned int xyz;

xyz = (unsigned int)abc;

Cheers.

like image 539
Neophile Avatar asked Jan 21 '26 11:01

Neophile


1 Answers

Use _tcstoul to get unsigned long value from string and then cast the value to unsigned int.

like image 99
Dialecticus Avatar answered Jan 23 '26 01:01

Dialecticus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!