473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

which one to use? string or wsting?

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?

Sep 12 '05 #1
5 2888
kathy wrote:
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
Sep 12 '05 #2
kathy wrote:
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.
Sep 12 '05 #3
kathy wrote:
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
--

Sep 12 '05 #4
John Harrison wrote:
kathy wrote:
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.


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

Sep 13 '05 #5
* Greg:
John Harrison wrote:
kathy wrote:
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.


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.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Sep 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Unforgiven | last post by:
I have the following situation: Given this class: template<typename T> class Expression { /* omitted */ }; This is the base class for a BooleanExpression and an ArithmeticExpression.
17
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
6
by: Markus Eßmayr | last post by:
Hello, I'd like to consume a WebService, which returns an array of objects which include several members of type System.String, System.Decimal and System.DateTime. In the WSDL-file, the members...
3
by: Balaji Kannan | last post by:
Hi, In dot net during component development i have used some member variables in the class file. Inside the class i have used the member declaration and the instant handling in the following...
4
by: Lerp | last post by:
Hi all, With regards to calling data from a database and filling in an editing form based on some query, which is the best (least intensive on processor) method for assigning the returned...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
2
by: Digital Fart | last post by:
following code would split a string "a != b" into 2 strings "a" and "b". but is there a way to know what seperator was used? string charSeparators = { "=", ">=", "<=" , "!=" }; string s1 =...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.