Convert the lpctstr to STD: String
Lpctstr folder_path; char STR [1024]; wsprintfa (STR, "% s", folder_path); string STR _ (STR );
Remove the string space:
# Include <iostream> # include <string> # include <boost/algorithm/string. HPP> using namespace STD; using namespace boost; int main () {string S = "Hello boost !! "; Trim (s); cout <S <Endl ;}
Conversion between string and wstring:
#include
# include
// prototype for conversion functionsstd: wstring stringtowstring (const STD :: string & S); STD: String wstringtostring (const STD: wstring & S); STD: wstring stringtowstring (const STD: string & S) {STD :: wstring temp (S. length (), l''); STD: Copy (S. begin (), S. end (), temp. begin (); Return temp;} STD: String wstringtostring (const STD: wstring & S) {STD: String temp (S. length (), ''); STD: Copy (S. begin (), S. end (), temp. begin (); Return temp;} using namespace STD; int main () {string S1 = "hello"; wstring S2 = stringtowstring (S1); S1 = wstringtostring (S2 ); return 0 ;}