I have a CString with a numeric string in it. In the past, I would use
atoi( ) to convert to an int. That doesn't work with Unicode though.
What is the proper Unicode method for converting a CString to an
integer?

Signature
- Burt Johnson
MindStorm, Inc.
http://www.mindstorm-inc.com/software.html
Guido Stercken-Sorrenti [MVP VC++] - 11 Jun 2005 23:50 GMT
> What is the proper Unicode method for converting a CString to an
> integer?
wcstol(), for example...

Signature
Guido Stercken-Sorrenti
MVP - Visual Developer / Visual C++
Burt Johnson - 12 Jun 2005 01:22 GMT
Guido Stercken-Sorrenti [MVP VC++] <mspbn@stercken-sorrenti.nospam.com>
wrote:
> > What is the proper Unicode method for converting a CString to an
> > integer?
>
> wcstol(), for example...
Thanks!

Signature
- Burt Johnson
MindStorm, Inc.
http://www.mindstorm-inc.com/software.html
Alex Blekhman - 12 Jun 2005 08:48 GMT
> I have a CString with a numeric string in it. In the
> past, I would use atoi( ) to convert to an int. That
> doesn't work with Unicode though.
>
> What is the proper Unicode method for converting a
> CString to an integer?
Proper method is _ttoi/_ttol. CString is a class that
contains generic characters: TCHAR's. So, when working with
it you need to use generic routines.
If you're using MSVC7[.1], then there is CStringT class now.
It has CString generic specialization; and CStringA and
CStringW for ANSI and Unicode, respectively.
Burt Johnson - 13 Jun 2005 10:05 GMT
Thanks everyone for your suggestions! Problem is now solved, and I am on
to bigger and (hopefully) better things. :-)
> I have a CString with a numeric string in it. In the past, I would use
> atoi( ) to convert to an int. That doesn't work with Unicode though.
>
> What is the proper Unicode method for converting a CString to an
> integer?

Signature
- Burt Johnson
MindStorm, Inc.
http://www.mindstorm-inc.com/software.html