Hi.... I'm trying to use a INI file in my program, but I don't know how to initialize it... I have the following procedure that plans to read a file called Monitor.ini:
procedure SetSerial;
var
Archivo : TIniFile;
Puerto : Byte;
Baudios : Integer;
begin
with Archivo do
begin
Create('Monitor.ini');
Puerto := ReadInteger('Setup','Puerto',2);
Baudios := ReadInteger('Setup','Baud',19200);
Archivo.Free;
Emulador.Serial.DeviceName := 'Com' + Chr(Puerto+$30);
case Baudios of
2400 : Emulador.Serial.BaudRate := br2400;
4800 : Emulador.Serial.BaudRate := br4800;
9600 : Emulador.Serial.BaudRate := br9600;
19200 : Emulador.Serial.BaudRate := br19200;
end;
end;
end;
When I compile it, compiler says the error that Archivo variable might not be initialized. What can I do before calling the Create method in order to initialize the object?
Thank in advance
Jaime
Archivo=TIniFile.Create('M
with Archivo do
begin
Puerto:=...
....
end;
Archivo.Free;
end;