Click here to Skip to main content
11,639,861 members (59,192 online)
Click here to Skip to main content

C++: Converting an MFC CString to a std::string

, 7 Apr 2011 CPOL 12.4K 11
Rate this:
Please Sign up or sign in to vote.
CString m_Name;CT2CA pszName(m_Name);std::string m_NameStd(pszName);Works for me everywhere... :)
CString m_Name;
CT2CA pszName(m_Name);
std::string m_NameStd(pszName);

Works for me everywhere... Smile | :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Canada Canada
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionMy vote of 5! Pin
Volynsky Alex4-Nov-14 19:05
professionalVolynsky Alex4-Nov-14 19:05 
General5! Pin
Pranit Kothari13-Dec-11 1:27
memberPranit Kothari13-Dec-11 1:27 
GeneralUse CT2CA (and A2W / T2A family) macros when you can. Just t... Pin
blytle13-May-11 2:02
memberblytle13-May-11 2:02 
GeneralReason for my vote of 5 Interesting to use the feature that ... Pin
Martin Richter [MVP C++]19-Apr-11 2:44
memberMartin Richter [MVP C++]19-Apr-11 2:44 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150731.1 | Last Updated 7 Apr 2011
Article Copyright 2011 by oleg63
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid