NAME=VALUE pairs are pretty easy to use and manipulate in Delphi,
for example you can easily load them into a stringlist from a txt or dat
file with the TStringList's own LoadFromFile method, and of course you can
also SaveToFile as well.  I use this technique a lot, however for what you
seem to want to do, Variables of the correct type will need to be created by
your compiled program first, then this file can be loaded into a TStringList
and each VALE read can then be assigned to the Variable assigned to that
particular NAME.  You could just as easily do this using an ini-file too.
But I don't know of anyway you can actually create new variables based upon
values picked up by the application at runtime.


from: Robert Meek at: [EMAIL PROTECTED] 
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
Proud to be a moderotor for the
"Delphi Programming Lists" at: elists.org 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Paule Ecimovic
Sent: Friday, September 23, 2005 4:23 AM
To: Borland's Delphi Discussion List
Subject: Generic way of reading a delineated list of variable values from
afile and loading them into a list of variables

Hi, all

    Does anyone know of a generic way of reading the values of a delineated
list of variables from a text file and loading them into Delphi variables of
the same name as occurs in the file? The file is structured according to the
beginning and end of the list of variables, also known as a NAMELIST of
variables, by begin_of_namelist and end_of_namelist tags. The entries of the
namelist are formatted between these tags as VariableName=VariableValue,
where VariableValue can be of any allowed type, whether primitive or
user-defined, so long as its values can be written to a file as plain text
and loaded from it accordingly.

This is a perenial problem for which I wonder whether generic solutions
exist.

Cheers,

    Paule
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to