For Programmers: Free Programming Magazines  


Home > Archive > VC STL > August 2005 > Re: Unicode support for STL string









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Unicode support for STL string
Mateusz Łoskot

2005-08-26, 3:57 am

Igor Tandetnik napisał(a):
> "Maansi Sanghi" <maansisanghi@abosoftware.com> wrote in message
> news:u9ZpkWYfFHA.2152@TK2MSFTNGP14.phx.gbl
>
> [...]
>
>
> That's one way of doing it. I personally prefer
>
> typedef std::basic_string<TCHAR> tstring;


Could you Igor tell me what is the difference between
your string specialized by TCHAR and std::wstring
which AFAIK is specialized by wchar_t.
TCHAR is a typedefed this way:

typedef wchar_t TCHAR;

Cheers

--
Mateusz Łoskot
mateusz at loskot dot net
Ulrich Eckhardt

2005-08-26, 7:58 am

Mateusz ?oskot wrote:
> TCHAR is a typedefed this way:
>
> typedef wchar_t TCHAR;


No it's not, it depends on _UNICODE (or UNICODE, I forgot):

#ifdef _UNICODE
typedef wchar_t TCHAR;
#else
typedef char TCHAR;
#entdif

This schema runs through the whole win32 API, where you have functions like
CreateFile( TCHAR const* filename, ...)
which in truth comes in two varieties:
CreateFileA( CHAR const* filename, ...)
CreateFileW( WCHAR const* filename, ...)
#ifdef _UNICODE
# define CreateFile CreateFileW
#else
# define CreateFile CreateFileA
#entdif

Uli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com