나그네 님이 쓰신 글 :
: boost에서 지원하는 ini 파일 입출력을 사용하려고 하는데 아래 함수에서
: TEditBox 에 있는 문자열을 다이렉트로 받아서 처리하려고 하면 에러가 발생해서 저장이 안됩니다.
:
: 여러 변환 방법을 써 봤는데 번번히 에러가 나네요..
: boost 나 STL 을 사용하게 되면 이런 문제가 빈번히 나올텐데 어떻게들 해결하시는 지요??
:
: void __fastcall TForm1::writeIniFile(const string& FileName)
: {
: boost::property_tree::ptree pt;
: string st ;
:
: pt.put<string>("Section.Value1", "test");
: pt.put<string>("Section.Value3", Edit1->Text) ;
: pt.put<int>("Section.Value2", 100);
:
: boost::property_tree::ini_parser::write_ini(FileName, pt );
: }
: //---------------------------------------------------------------------------
typedef std::basic_string<char> AStringType;
typedef std::basic_string<wchar_t> WStringType;
WStringType wstr1(L"문자열");
UnicodeString wstr2(wstr1.c_str());
Label1->Caption = wstr2;
WStringType wstr3(wstr2.c_str());
AnsiString astr4(wstr1.c_str());
Label2->Caption = astr4;
WideString wstr5(astr4.c_str());
Label3->Caption = wstr5;
AnsiString astr6(wstr5.c_bstr());
Label4->Caption = astr6;
WStringType wstr7(wstr5.c_bstr());
AStringType astr8(astr4.c_str());
|