If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: using std::string unicode build

For UNICODE you have std::wstring. You will also have a problem with strings such as "log". They should be replaced with L"log". To compile both with ANSI and UNICODE use the _T() macro to wrap all the strings and chars in your code.

Re: using std::string unicode build

thats where the twist comes in ;i dont want to do a ifdef at each line where i have used std::string for the different build-types.
And if i do a _T on c_str member ,it wont accept in UNICODE.
So what is a least-painful way to make this std::string work in such situations - we use std::string at a lot of places in the code ;and we cant use a ifdef/std::wstring option easily?

Re: using std::string unicode build

Why Not you Follow Cilu Suggestion and Proceed in a Simple Way Note T("string") or TEXT("string") are macros which become L"string" if UNICODE is defined, and "string" if UNICODE is not defined.and to defined unicode you can use #define unicode before you include windows.

here is how you can convert your Unicode to ASCII string and ASCII to Unicode.

Re: using std::string unicode build

Sure.i also believe the same.
A couple of questions on this issue:
'typedef basic_string<TCHAR> tstring' expands to a wstring for UNICODE and string for MBCS - is that right?
So,c_str member returns a LPCTSTR(char* in MBCS and wchar* in UNICODE).
is that correct?