//把写入结果显示在 Memo 看看 procedure TForm1.Button2Click(Sender: TObject); begin if not FileExists(FilePath) then Exit; Memo1.Lines.LoadFromFile(FilePath); end;
//读取测试 procedure TForm1.Button3Click(Sender: TObject); var buf: array[Byte] of Char; {准备接受缓冲区} begin GetPrivateProfileString('段1', 'Key2', '默认值', buf, Length(buf), PChar(FilePath)); ShowMessage(buf); end;