Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Nov : Why is my .INI file not being located and read from?

www.cryer.info
Managed Newsgroup Archive

Why is my .INI file not being located and read from?

Subject:Why is my .INI file not being located and read from?
Posted by:"Clay Shannon" (blac..@redgreen.com)
Date:Tue, 7 Nov 2006 18:07:22

1) I have a run-time param for my app of "ws1" (without the quotes)


2) I have an .INI file named ws1.INI which is in the same directory as the
.EXE and contains these values:


[ServerConnectivitySettings]

ServerIPAddress=127.0.0.1

[RealTimeConnectivitySettings]

RealTimeClientHost=10.172.2.93

RealTimeClientPort=123

RealTimeServerPort=1234


3) I try to read from it with this code:


const

  sRealTimeConnectivitySECTION = 'RealTimeConnectivitySettings';

  sRealTimeClientHostITEM = 'RealTimeClientHost';

  sRealTimeClientPortITEM = 'RealTimeClientPort';

  sRealTimeServerPortITEM = 'RealTimeServerPort';

var

  JCPClientINI: TINIFile;

begin

  JCPClientINI := TINIFile.Create(Format('%s.INI', [ParamStr(1)]));

  try

    ClientSocketRT.Host :=

      JCPClientINI.ReadString(sRealTimeConnectivitySECTION,

                              sRealTimeClientHostITEM,

                              DEFAULT_RT_HOST);

    . . .


--and yet the default value (DEFAULT_RT_HOST) is used instead of the value
in ws1.INI. Why?

--
Download my historical nonfiction and/or satirical (etc.) fiction books free
from here:
http://www.lulu.com/blackbirdcraven

Replies:

www.cryer.info
Managed Newsgroup Archive