|
푸우... 그냥 함 만들어봤습니다. Help 파일을 열심히 보셨으면 쉽게 해결하셨을텐데...
항상 아쉽습니다.
폼에 메모 컴퍼넌트(TMemo) 하나 올려놓고 #include <IniFiles.hpp> 추가해주시고 테스트하시면 됩니다.
버튼 하나 올려서 클릭 이벤트에 코딩하였습니다.
그럼 즐빌~
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIniFile* pIniFile = new TIniFile( ExtractFilePath(Application->ExeName) + ChangeFileExt(ExtractFileName(Application->ExeName), ".ENV") );
////
pIniFile->WriteString( "Section_1", "Ident_1", "테스트 값A" );
pIniFile->WriteString( "Section_1", "Ident_2", "테스트 값B" );
pIniFile->WriteString( "Section_1", "Ident_3", "테스트 값C" );
pIniFile->WriteString( "Section_1", "Ident_4", "테스트 값D" );
pIniFile->WriteString( "Section_1", "Ident_5", "테스트 값E" );
pIniFile->WriteString( "Section_2", "Ident_1", "테스트 값A" );
pIniFile->WriteString( "Section_2", "Ident_2", "테스트 값B" );
pIniFile->WriteString( "Section_2", "Ident_3", "테스트 값C" );
pIniFile->WriteString( "Section_2", "Ident_4", "테스트 값D" );
pIniFile->WriteString( "Section_2", "Ident_5", "테스트 값E" );
////
TStringList* pSections = new TStringList();
TStringList* pIdents = new TStringList();
TStringList* pValues = new TStringList();
pIniFile->ReadSections( pSections );
Memo1->Lines->Clear();
for( int i = 0; i < pSections->Count; i++ )
{
Memo1->Lines->Add( "Section name is " + pSections->Strings[i] );
Memo1->Lines->Add( "" );
pIniFile->ReadSection( pSections->Strings[i], pIdents );
for( int j = 0; j < pIdents->Count; j++ )
{
Memo1->Lines->Add( " Ident name is " + pIdents->Strings[j] );
}
Memo1->Lines->Add( "" );
pIniFile->ReadSectionValues( pSections->Strings[i], pValues );
for( int l = 0; l < pValues->Count; l++ )
{
Memo1->Lines->Add( " Ident and Value is " + pValues->Strings[l] );
Memo1->Lines->Add( " Ident is " + pValues->Names[l] );
Memo1->Lines->Add( " Value is " + pValues->Values[pValues->Names[l]] );
Memo1->Lines->Add( "" );
}
}
////
if( pValues )
delete pValues;
if( pIdents )
delete pIdents;
if( pSections )
delete pSections;
if( pIniFile )
delete pIniFile;
}
초보 님이 쓰신 글 :
: 하안인 님이 쓰신 글 :
: : 초보 님이 쓰신 글 :
: : : 메모장에 입력한 값을 INIFILE로 저장을 했는데 다른 메모장으로 이걸 다시 불러 오니까 한줄만 나옵니다.
: : : 여러줄을 입력 했는데 한줄만 나와서요
: : : LoadFormFile하면 되지만 INIFILE을 사용해서 불러오고 싶습니다.
: : :
: : : ________________
: : : |Memo1 |
: : : | 한글나라 |
: : : | 한글 최고 |
: : : | |
: : : | |
: : : | |
: : : | |
: : : ----------------
: : : 이렇게 입력 한다음
: : : ini->WriteString("43" , "1" , Memo1->Text);//이런식으로
: : : ________________
: : : |Memo2 |
: : : | 한글나라 |
: : : | |
: : : | |
: : : | |
: : : | |
: : : | |
: : : ----------------
: : : Memo2->Text = ini->ReadString("43" , "1" , "값이 안나옵니다");
: :
: : 메모장을 왜 한칸씩 읽어들이지는것인지는 모르겠지만
: : 위에것을 하려면요..
: :
: : ini->WriteString("43",IntToStr(i),Memo1->Lines->Strings[i]);
: : 로 칸수만큼 집어넣고
: : 칸수만큼 불러오면 될것같습니다.
: :
: : 즉,
: : 1.메모에 입력된 칸수를 구하고
: : 2.그 회수만큼 저장하고
: :
: : 불러올때는
: : 섹션의 값이 있을때 까지 불러오면 될것이고...
: :
: : 도움이 되었는지 모르겠네요..
|