Click here to Skip to main content
Click here to Skip to main content

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

By , 7 Apr 2011
 
CString m_Name;
CT2CA pszName(m_Name);
std::string m_NameStd(pszName);

Works for me everywhere... :)

License

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

About the Author

oleg63
Software Developer (Senior) Enginia Research Inc.
Canada Canada
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
General5! PinmemberPranit Kothari13 Dec '11 - 1:27 
GeneralUse CT2CA (and A2W / T2A family) macros when you can. Just t... Pinmemberblytle13 May '11 - 2:02 
GeneralReason for my vote of 5 Interesting to use the feature that ... PinmemberMartin 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.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130513.1 | Last Updated 7 Apr 2011
Article Copyright 2011 by oleg63
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid