zoukankan      html  css  js  c++  java
  • WriteMemoItems()ReadMemoItems() IniFiles

    uses IniFiles;
     
    {写入Memo中的项目到ini中}
    //调用   WriteMemoItems('settings.ini','MEMO',Memo1);
    procedure WriteMemoItems(const AINIFile, ASection: string; MEMO: TMemo);
    var
      INI: TINIFile;
      iniPath:string;//ini路径
      I: Integer;
    begin;
      iniPath:=ExtractFilePath(Application.ExeName)+AINIFile;
      INI := TINIFile.Create(iniPath);
      try
        INI.EraseSection(ASection);
        INI.WriteInteger(ASection, 'Count', MEMO.Lines.Count);
        for I := 0 to MEMO.Lines.Count - 1 do
        begin
          INI.WriteString(ASection, 'Item' + IntToStr(I), MEMO.Lines[I]);
        end;
      finally
        INI.Free;
      end;
    end;


    {读取ini中的信息到Memo中}
    //调用   ReadMemoItems('settings.ini','MEMO',Memo1);
    procedure ReadMemoItems(const AINIFile, ASection: string; MEMO: TMemo);
    var
      INI: TINIFile;
      iniPath:string;
      I,count: Integer;
    begin
      iniPath:=ExtractFilePath(Application.ExeName)+AINIFile;
      INI := TINIFile.Create(iniPath);
      try
        MEMO.Clear;
        Count := INI.ReadInteger(ASection, 'Count', 0);
        for I := 0 to Count - 1 do
        begin
          MEMO.Lines.Add(INI.ReadString(ASection, 'Item' + IntToStr(I), '0'));
        end;
      finally
        INI.Free;
      end;
    end;
     




    附件列表

    • 相关阅读:
      iOS 的 XMPPFramework 简介
      Swift闭包
      Objective-C类成员变量深度剖析
      iOS Auto Layout
      iOS WIFI
      AppStore提审攻略
      iOS7 修改导航系统默认返回按钮文字及颜色
      iOS Block浅析
      Latency
      Charles抓包工具的使用
    • 原文地址:https://www.cnblogs.com/xe2011/p/2609333.html
    Copyright © 2011-2022 走看看