Bonjour,

Je n'arrive pas à faire fonctionner la fonction GetNameValue de TStrings.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
program Test;
 
uses
    inifiles, Classes;
 
var
   aIniFile : TINIFile;
   aStringList : TStrings;
   i : Integer;
   skey, svalue : String;
 
begin
 
     aIniFile:= Tinifile.create('o_config.ini');
 
     aStringList := TStringList.Create;
     aIniFile.ReadSection('SAV_LEVEL1', aStringList);
 
     // Read keys
     for i := 0 to aStringList.Count - 1 do
     begin
                aStringList.GetNameValue(i, skey, svalue);
 
                WriteLn(skey + ' ' + svalue);
                //Break;
     end;
 
   Readln();
 
   aIniFile.free;
   aStringList.Destroy;
end.
Le compilateur dit :
Error: Call by var for arg no. 3 has to match exactly: Got "ShortString" expected "AnsiString"

Pfff..... et donc, que faire svp ?