Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Feb : Console app reading INI

www.cryer.info
Managed Newsgroup Archive

Console app reading INI

Subject:Console app reading INI
Posted by:"Charles Collins" (cc..@houstonyellowcab.com)
Date:Thu, 21 Feb 2008 14:51:30 +0000 (UTC)

I have a console app reading 2 parameters from an INI file:

   Ini := TIniFile.Create('DateDir.INI');
   Try
      DirStub := Ini.ReadString('DateDir','BaseDir','D:\');
      DateOffset := Ini.ReadInteger('DateDir','DateOffset',1);
   finally
      Ini.free;
   end;

The INI file contains:

[DateDir]
BaseDir=c:\temp
DateOffset=1

The DateOffset is reading correctly and doing as expected.  The DirStub (the
ReadString) however fails and returns the default D:\ in all cases.

I have changed the order of the read, the order in the INI file, tried using
other tags (just in case) but can not seem to get the bug fixed.

Using Delphi7 enterprise, Windows XP Pro.

Does anyone have a solution?

Thanks.

Replies:

www.cryer.info
Managed Newsgroup Archive