wchar_t and wstring with -fshort-wchar optinon with g++.

V

Vinu

Hi
I have one problem. I compiled my program with -fshort-wchar
option using g++. In my program I am using wstring also. In some places
I converted the wchar_t variable to wstring .


wstring str;
const wchar_t* Root=L"One";
const wchar_t* Node=L"Point No";


if (Root){
str.append(1, '.') += Root;
}
str.append(Node);


at the end of the function ,
I want a string in str like "Point No . One".


But in my case the str contains a string like "Point No \0 . One".
Anyone one can suggest a way to do it .What is the problem...? I am
using Solaris SPARC & g++ 3.4.2.


Thanks & Regards
--Vinu
 
M

msalters

Vinu schreef:
Hi

wstring str;
const wchar_t* Root=L"One";
const wchar_t* Node=L"Point No";


if (Root){
str.append(1, '.') += Root;
}
str.append(Node);

I want a string in str like "Point No . One".

a wchar_t literal is also prefixed with :, like L'.'

HTH,
Michiel Salters
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top