Hi,

Is there a more cute way to use the string conversion functions then
this :

CString szCategories;
...
#if defined(WIN64)
INT_PTR nCategories = _ttoi64(szCategories)
#else
int nCategories = _ttoi(szCategories)
#endif

Is there a function like this exist _ttoi_ptr() ?

Regards,
Eric

Re: _ttoi() family portable 32-bit and 64-bit by Alex

Alex
Wed Oct 25 04:10:55 CDT 2006

Eric wrote:
> Hi,
>
> Is there a more cute way to use the string conversion functions then
> this :
>
> CString szCategories;
> ...
> #if defined(WIN64)
> INT_PTR nCategories = _ttoi64(szCategories)
> #else
> int nCategories = _ttoi(szCategories)
> #endif
>
> Is there a function like this exist _ttoi_ptr() ?


You could define it yourself:

#if defined(WIN64)
# define ttoi_ptr _ttoi64
#else // WIN32
# define ttoi_ptr _ttoi
#endif // WIN64

Then just use it in code:

INT_PTR nCategories = ttoi_ptr(szCategories);


HTH
Alex