delphi - reading 2 lines from IniFile -


trying again. on advice, adding piece of code understand. fine fact have save 4 bits of information in 2 lines so:

inifile.writestring('testsection','name','country'); inifile.writestring('testsection','city','street'); 

my question more loading information form. if in inifile have saved example following code

[testsection] john=uk london=barlystreet mike=spain madrid=eduardostrata emma=usa new york=1st avenue 

made information in inifile. added through code above. question is: how load example, when type in edit box mike, rest of belonging information.(spain, madrid,eduardostrata).

that's not how ini file works. save name=value pairs, , have have way associate them.

maybe can started:

ini := tinifile.create(yourinifilename); try   ini.writestring('mike', 'country', 'spain');   ini.writestring('mike', 'city', 'madrid');   ini.writestring('mike', 'street', 'eduardostrata');   ini.free; end; 

results in ini file containing:

[mike] country=spain city=madrid street=eduardostrata 

to load back:

var   country, city, street: string;   ini: tinifile; begin   ini := tinifile.create(yourinifilename);   try     country := ini.readstring('mike', 'country', '<none>');     city := ini.readstring('mike', 'city', '<none>');     street := ini.readstring('mike', 'street', '<none>');       ini.free;   end;   // country, city, , street equal values 'mike',   // or contain '<none>' if section 'mike' doesn't   // exist or has no values variable. end; 

so can figure out how works. section (the part in []) person's name, , name/value pairs location , it's corresponding value (for instance, 'country=spain').


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -