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

C / C++ / MFC

 
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 
Have you tried "mbstowcs" or "mbstowcs_s" in stdlib.h.

std::string mbstr = "The string!";<br />
std::vector<wchar_t> wcstr(mbstr.size() + 1, L'\0');<br />
<br />
size_t written = 0;<br />
mbstate_t  state = {0};<br />
const char* pmbstr = mbstr.c_str();<br />
<br />
errno_t result = mbsrtowcs_s(&written, &wcstr[0], <br />
	 wcstr.size(), &pmbstr, mbstr.size(), &state);<br />
<br />
std::wcout << &wcstr[0] << std::endl;


-- modified at 20:19 Thursday 28th September, 2006
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 
GeneralRe: std::string to const WCHAR* Pin
Stick^29-Sep-06 6:52
Stick^29-Sep-06 6:52 
QuestionNewbie Help Please Pin
Mithin28-Sep-06 7:18
Mithin28-Sep-06 7:18 
QuestionRe: Newbie Help Please Pin
David Crow28-Sep-06 7:51
David Crow28-Sep-06 7:51 
AnswerRe: Newbie Help Please Pin
Mithin28-Sep-06 8:14
Mithin28-Sep-06 8:14 
GeneralRe: Newbie Help Please Pin
David Crow28-Sep-06 8:46
David Crow28-Sep-06 8:46 
QuestionLoading a bitmap from a *.BMP file Pin
TheDelChop28-Sep-06 7:10
TheDelChop28-Sep-06 7:10 
AnswerRe: Loading a bitmap from a *.BMP file Pin
Chris Losinger28-Sep-06 7:25
professionalChris Losinger28-Sep-06 7:25 
GeneralRe: Loading a bitmap from a *.BMP file Pin
TheDelChop28-Sep-06 7:27
TheDelChop28-Sep-06 7:27 
GeneralRe: Loading a bitmap from a *.BMP file Pin
Chris Losinger28-Sep-06 7:38
professionalChris Losinger28-Sep-06 7:38 
GeneralRe: Loading a bitmap from a *.BMP file Pin
TheDelChop28-Sep-06 7:44
TheDelChop28-Sep-06 7:44 
GeneralRe: Loading a bitmap from a *.BMP file Pin
Chris Losinger28-Sep-06 7:54
professionalChris Losinger28-Sep-06 7:54 
GeneralRe: Loading a bitmap from a *.BMP file Pin
TheDelChop28-Sep-06 9:15
TheDelChop28-Sep-06 9:15 
GeneralRe: Loading a bitmap from a *.BMP file Pin
Chris Losinger28-Sep-06 9:30
professionalChris Losinger28-Sep-06 9:30 

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.