C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[38326] Re:[질문]TIniFIle 클래스의 속성을 이용해서... 특정 섹터의 내용을 지우고 싶은데요..
이현진 [cyberpd] 1064 읽음    2004-12-09 07:37
main_TK 님이 쓰신 글 :
: TIniFIle 클래스의 속성을 이용해서... 특정 섹터의 내용을 지우고, 또는 섹션이름을 변경하는 방법 싶은데요..
:
: 섹션 추가는 알겠는데... 지우거나 특정세션의 이름을 변경하는 건 어떻게 해야 할지 모르겠습니다.
: 답변주십시요..감사합니다..

TINIFile의 EraseSection, DeleteKey 메서드를 이용하시면 원하시는 작업을 하실 수 있을 겁니다.
이름을 변경하는것은 기존 섹션이나, 키를 값을 읽고 다른 이름의 섹션/키 값으로 Write 하시면 되겠죠..

사용 예는 Builder의 Visual component Library Reference Help TIniFile의 example에 있습니다.


void __fastcall TForm1::Button1Click(TObject *Sender)

{
  TIniFile *pMyIniFile = new TIniFile("\\usr\\MyApp.ini");
  Memo1->Clear();
  pMyIniFile->ReadSectionValues("Transfer", Memo1->Lines);
  if (Memo1->Lines->Values["Title1"] != "Picture Painter")
    pMyIniFile->WriteString("Transfer","Title1","Picture Painter");
  delete pMyIniFile;
}

void __fastcall TForm1::Button2Click(TObject *Sender)

{
  TIniFile *pMyIniFile = new TIniFile("\\usr\\MyApp.ini");
  // if the entry wasn뭪 there before, delete it now
  if (Memo1->Lines->Values["Title1"] == "")
    pMyIniFile->DeleteKey("Transfer", "Title1");
  // otherwise, restore the old value
  else
    pMyIniFile->WriteString("Transfer", "Title1", Memo1->Lines->Values["Title1"]);
  delete pMyIniFile;
}

+ -

관련 글 리스트
38323 [질문]TIniFIle 클래스의 속성을 이용해서... 특정 섹터의 내용을 지우고 싶은데요.. main_TK 725 2004/12/08
38326     Re:[질문]TIniFIle 클래스의 속성을 이용해서... 특정 섹터의 내용을 지우고 싶은데요.. 이현진 1064 2004/12/09
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.