4
I want to read the ini file of a site, but I’m not getting.
I tried so:
inicheck := 'http://pokestage.ddns.net/patch/CHECK.INI';
conf2 := TIniFile.Create(IdHTTP3.Get(inicheck));
version2 := conf2.ReadString('CONFIG', 'TVERSION', '');
But it’s not working.
How it should be done?
I tested it like this:
var
conf2 : TIniFile;
version2 : string;
inicheck : string;
path : string;
tempfile : TFileStream;
begin
path := extractFilepath(application.exename);
inicheck := 'http://pokestage.ddns.net/patch/CHECK.INI';
tempfile := TFileStream.Create('SCHECK.INI', fmCreate);
try
tempfile.Position:=0;
IdHTTP3.Get(inicheck, tempfile);
tempfile.Free;
conf2 := TIniFile.Create(path+'\SCHECK.INI');
version2 := conf2.ReadString('CONFIG', 'TVERSION', '');
finally
conf2.Free;
end;
ShowMessage('Client '+version);
ShowMessage('Servidor '+version2)
And I didn’t, I don’t see the difference between yours and mine. The client, worked, being the same thing.
Edit: I got it, I was putting tempfile.free; in the wrong place, you have to close before creating ini. I already set in the example.
Yes, but it worked. rs.
– Gabriel Sales