-
섹션 키값 추출C++ Builder/사용자 정의 함수 2019. 1. 25. 17:28
void __fastcall TMainF::fnLoadData()
{
TStringList *pList = new TStringList();
TStringList *pTempList = new TStringList();
TStringList *pSectList = new TStringList();
UnicodeString sTemp = "";
UnicodeString sShow = "";
AnsiString sPath;
sPath = ExtractFilePath(Application->ExeName) + "TcpServer_Project.ini";
TIniFile* pIni = new TIniFile(sPath);
pTempList->Delimiter = '=';
pIni->ReadSections(pSectList); // 각 섹션을 리스트로 읽어오기
// 섹션 키이름과 키값을 리스트로 읽어오기
for (int i = 0; i < pSectList->Count ; i++) {
pIni->ReadSectionValues(pSectList->Strings[0], pList);
}
// 키이름과 키값 확인출력
for (int i=0; i<pList->Count; i++) {
Memo1->Lines->Add(pList->Strings[i]);
}
// 키값만 따로 리스트로 읽어오기
for (int i=0; i<pList->Count; i++) {
sTemp = pList->Strings[i];
pTempList->DelimitedText = sTemp;
sShow += (pTempList->Strings[1] + ",");
}
pList->Clear();
pList->CommaText = sShow;
// 키값 확인출력
for (int i=0; i<pList->Count; i++) {
Memo1->Lines->Add(pList->Strings[i]);
}
delete pSectList;
delete pTempList;
delete pList;
delete pIni;
}
728x90'C++ Builder > 사용자 정의 함수' 카테고리의 다른 글
price(가격) Edit (0) 2019.03.20 댓글