Hi,
I have a XML config file which looks like this:
<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
<Confirmations ExitProgram="0"/>
<Database StandardDirectory=""/>
</CONFIG>
I now try to load these options at program start:
function GetInt(const APath: WideString; const ADefault: WideString): LongInt;
var b: Boolean;
i: LongInt;
begin
b := TryStrToInt(AnsiString(frmOpt.XMLConfig.GetValue(APath, ADefault)),i);
if (not b) then
flag := True;
exit(i);
end;
This works for bla := GetInt('Confirmations/ExitProgram','');
I now try to load the string values with this:
function GetString(const APath: WideString; const ADefault: WideString): String;
var s: String;
begin
s := AnsiString(frmOpt.XMLConfig.GetValue(APath, ADefault));
exit(s);
end;
This does NOT work for DbDatabaseDir := GetString('Database/StandardDirectory','');
(It doesn't work either when I omit the AnsiString-Cast...
The debugger says, the variable is NIL.
Any ideas?
Thx,
--Dietmar