which one to use? string or wsting?

K

kathy

I would like to use STL string in my C++ application. The target
machine could be windows 95/98/2000/XP. I know windows 95/98 using
ASCII and windows 2000/XP use UNICODE. In Microsoft MFC, there is
TCHAR. Is there tstring exsisted? If not, how to use use string for
UNICODE platform?
 
J

John Harrison

kathy said:
I would like to use STL string in my C++ application. The target
machine could be windows 95/98/2000/XP. I know windows 95/98 using
ASCII and windows 2000/XP use UNICODE. In Microsoft MFC, there is
TCHAR. Is there tstring exsisted? If not, how to use use string for
UNICODE platform?

It's not hard to define tstring

typedef std::basic_string<TCHAR> tstring;

There you are, tstring defined.
 
V

Victor Bazarov

kathy said:
I would like to use STL string in my C++ application. The target
machine could be windows 95/98/2000/XP. I know windows 95/98 using
ASCII and windows 2000/XP use UNICODE. In Microsoft MFC, there is
TCHAR. Is there tstring exsisted? If not, how to use use string for
UNICODE platform?

I think wstring should be sufficient, although it might depend on the
version of UNICODE you want to support. The best place to ask would
be the newsgroup for the target platform or the compiler you're going
to use.

V
 
W

Wolfgang Draxinger

kathy said:
I would like to use STL string in my C++ application. The
target machine could be windows 95/98/2000/XP. I know windows
95/98 using ASCII and windows 2000/XP use UNICODE. In Microsoft
MFC, there is TCHAR. Is there tstring exsisted? If not, how to
use use string for UNICODE platform?

If you can go with LGPL you might want to have a look at GTKmm,
or more precicely its Glib::ustring. Usage is exactly the same
as with std::string but it is designed to correctly deal with
UTF-8 strings i.e. count characters correctly and some other
stuff.

Wolfgang Draxinger
--
 
G

Greg

John said:
It's not hard to define tstring

typedef std::basic_string<TCHAR> tstring;

There you are, tstring defined.

Defined, but not necessarily implemented.

The std::basic_string template requires an explicit instantation of
std::char_traits with the same parameterized character type. So a
program would not be able to actually declare or use a tstring object,
unless (or until) std::char_traits<TCHAR> has been implemented,

Greg
 
A

Alf P. Steinbach

* Greg:
Defined, but not necessarily implemented.

The std::basic_string template requires an explicit instantation of
std::char_traits with the same parameterized character type. So a
program would not be able to actually declare or use a tstring object,
unless (or until) std::char_traits<TCHAR> has been implemented,

That's not a problem here. TCHAR is either char or wchar_t.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top