Click here to Skip to main content
15,919,774 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 9:03
James R. Twine28-Sep-06 9:03 
GeneralRe: std::string to const WCHAR* Pin
David Crow28-Sep-06 9:16
David Crow28-Sep-06 9:16 
GeneralRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 12:35
James R. Twine28-Sep-06 12:35 
GeneralRe: std::string to const WCHAR* Pin
Jörgen Sigvardsson28-Sep-06 12:42
Jörgen Sigvardsson28-Sep-06 12:42 
GeneralRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 14:01
James R. Twine28-Sep-06 14:01 
GeneralRe: std::string to const WCHAR* Pin
Jörgen Sigvardsson28-Sep-06 14:06
Jörgen Sigvardsson28-Sep-06 14:06 
QuestionRe: std::string to const WCHAR* Pin
David Crow28-Sep-06 16:11
David Crow28-Sep-06 16:11 
GeneralRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 17:16
James R. Twine28-Sep-06 17:16 
   std::wstring::c_str() returns a const WCHAR* (const wchar_t*), but not std::string:c_str(), which is what the OP was asking about.

   I think that we (I?) are just getting confused about what "width" of string object is in use here.  The OP is dealing with having a std::string (ANSI) object and needs to get a (presumably valid) const WCHAR* (Unicode) out of it.

   Since they cannot simply change the strings from std::string to std::wstring, they are stuck with ANSI string objects, and no amount of casting is going to create a valid wide string from the return of std::string:c_str().   They need to call a conversion function (either directly or indirectly) in order to translate the string correctly.

   Peace!

-=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites
(Please rate this post!)

GeneralRe: std::string to const WCHAR* Pin
David Crow29-Sep-06 2:39
David Crow29-Sep-06 2:39 
GeneralRe: std::string to const WCHAR* Pin
Stick^28-Sep-06 9:00
Stick^28-Sep-06 9:00 
GeneralRe: std::string to const WCHAR* Pin
David Crow28-Sep-06 9:20
David Crow28-Sep-06 9:20 
AnswerRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 8:45
James R. Twine28-Sep-06 8:45 
GeneralRe: std::string to const WCHAR* Pin
Stick^28-Sep-06 9:02
Stick^28-Sep-06 9:02 
GeneralRe: std::string to const WCHAR* Pin
James R. Twine28-Sep-06 9:05
James R. Twine28-Sep-06 9:05 
GeneralRe: std::string to const WCHAR* Pin
Jörgen Sigvardsson28-Sep-06 14:09
Jörgen Sigvardsson28-Sep-06 14:09 
AnswerRe: std::string to const WCHAR* Pin
Zac Howland28-Sep-06 8:55
Zac Howland28-Sep-06 8:55 
GeneralRe: std::string to const WCHAR* Pin
Stick^28-Sep-06 9:03
Stick^28-Sep-06 9:03 
GeneralRe: std::string to const WCHAR* Pin
David Crow28-Sep-06 9:23
David Crow28-Sep-06 9:23 
GeneralRe: std::string to const WCHAR* Pin
Zac Howland28-Sep-06 9:24
Zac Howland28-Sep-06 9:24 
GeneralRe: std::string to const WCHAR* Pin
Stick^28-Sep-06 11:41
Stick^28-Sep-06 11:41 
GeneralRe: std::string to const WCHAR* [modified] Pin
George L. Jackson28-Sep-06 12:50
George L. Jackson28-Sep-06 12:50 
GeneralRe: std::string to const WCHAR* Pin
Jörgen Sigvardsson28-Sep-06 14:14
Jörgen Sigvardsson28-Sep-06 14:14 
GeneralRe: std::string to const WCHAR* Pin
Stick^29-Sep-06 6:54
Stick^29-Sep-06 6:54 
GeneralRe: std::string to const WCHAR* Pin
Zac Howland29-Sep-06 3:33
Zac Howland29-Sep-06 3:33 
GeneralRe: std::string to const WCHAR* Pin
James R. Twine30-Sep-06 18:40
James R. Twine30-Sep-06 18:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.