BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIniFile - is it thread / process safe?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Paul
Guest





PostPosted: Tue Apr 25, 2006 9:03 pm    Post subject: TIniFile - is it thread / process safe? Reply with quote



Hi,

If I have multiple threads or processes reading an ini file using the above
component (never writing), is this safe?

Paul
Back to top
Frode Nilsen
Guest





PostPosted: Wed Apr 26, 2006 8:03 am    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote



Paul wrote:

Quote:
Hi,

If I have multiple threads or processes reading an ini file using the
above component (never writing), is this safe?

Paul

If you only read the file, use TMemIniFile instead.

--
frode
Back to top
Hans Galema
Guest





PostPosted: Thu Apr 27, 2006 8:03 am    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote



Paul wrote:

Quote:
My next question is not quite to do with INI files, but where to find them.

It is completely up to you to decide where your program stores it's ini file(s).

Quote:
If I use GetCurrentDir (and SetCurrentDir), what does this actually mean,

That will give the last directory where a fileaction has been done by your
program. When you use relative paths then that info is important. But you
better use absolute paths.

Quote:
What I want is the INI file to be located in the directory of the
application or DLL,

Very good.

Then, if you give the inifile the same name as your program,:

AnsiString IniFileName = ChangeFileExt ( ParamStr(0), ".ini" );

Quote:
and not in the Windows directory;

Very good.

Hans.
Back to top
Paul
Guest





PostPosted: Thu Apr 27, 2006 8:03 am    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote

Is the benefit of this variant that on instantiating the component, that the
INI file is in memory and faster to read, and the TIniFile variant searches
the file every time?

My next question is not quite to do with INI files, but where to find them.
If I use GetCurrentDir (and SetCurrentDir), what does this actually mean, is
it scoped to Windows, just the application, and what if its used by a DLL?

What I want is the INI file to be located in the directory of the
application or DLL, and not in the Windows directory; I don't want to hard
code where to find it.

Paul


"Frode Nilsen" <frode (AT) auticon (DOT) no> wrote in message
news:444f2015 (AT) newsgroups (DOT) borland.com...
Quote:
Paul wrote:

Hi,

If I have multiple threads or processes reading an ini file using the
above component (never writing), is this safe?

Paul

If you only read the file, use TMemIniFile instead.

--
frode
Back to top
Paul
Guest





PostPosted: Thu Apr 27, 2006 9:03 am    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote

Thanks.

Quote:
Then, if you give the inifile the same name as your program,:

AnsiString IniFileName = ChangeFileExt ( ParamStr(0), ".ini" );
Back to top
Frode Nilsen
Guest





PostPosted: Thu Apr 27, 2006 10:03 am    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote

Paul wrote:

Quote:
"Frode Nilsen" <frode (AT) auticon (DOT) no> wrote in message
news:444f2015 (AT) newsgroups (DOT) borland.com...
Paul wrote:


If I have multiple threads or processes reading an ini file using
the above component (never writing), is this safe?

If you only read the file, use TMemIniFile instead.


Is the benefit of this variant that on instantiating the component,
that the INI file is in memory and faster to read, and the TIniFile
variant searches the file every time?

The benefit is that you don't lock the file, or have update conflicts
with other's reading/writing the same file.

Quote:

What I want is the INI file to be located in the directory of the
application or DLL, and not in the Windows directory; I don't want to
hard code where to find it.


ExtractFilePath(Application->ExeName) + "filename.ini" should do the
trick

--
frode
Back to top
Paul
Guest





PostPosted: Thu Apr 27, 2006 8:03 pm    Post subject: Re: TIniFile - is it thread / process safe? Reply with quote

Thanks everyone.

Quote:
ExtractFilePath(Application->ExeName) + "filename.ini" should do the
trick

--
frode
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.