To use an .INI file;
First create an .ini file with the example content:
[P_LOG]
command = test
Function to read the .ini file:
function TForm1.LeIni(sIndice, sCampo: string): string;
var
ArqIni: TIniFile;
begin
try
Result := '';
ArqIni := TIniFile.Create(ExtractFilePath(Application.ExeName) +'Teste.ini');
try
Result := Trim(ArqIni.ReadString(sIndice, sCampo, ''));
finally
ArqIni.Free;
end;
except
ShowMessage
('Não foi possível encontrar o arquivo de Parâmetros .ini');
end;
end;
Using the
procedure TForm1.Button3Click(Sender: TObject);
var
ConteudoArquivoINI :String;
begin
ConteudoArquivoINI := LeIni('P_LOG', 'comando')) the
end;