Solved

Ini_file

Posted on 2002-03-06
4
198 Views
Last Modified: 2010-04-05
Hi all
I need to write a small progman.
program read and write to ini-file.
And i want to keep inifile in program homedirectory

this code works but Is there any other way to locate file?

pelaajatiedot:=Tinifile.Create('c:\homedir\PackAliases.ini');

Thanks
Janozzy
0
Comment
Question by:janozzy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 6844779
pelaajatiedot:=Tinifile.Create(ExtractFilePath(Application.exeName)+'TheIniFileName.Ini');

meikl ;-)
0
 

Author Comment

by:janozzy
ID: 6844799
ou jes

Thanks
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6844846
glad to helped you ;-)
0
 
LVL 6

Expert Comment

by:reddarin
ID: 6852436
I find it very handy to use ChangeFileExt() like so:

var
  IFile: TIniFile;
begin
  try
  IFile := TIniFile.Create(ChangeFileExt(paramstr(0),'.ini'));
  //do stuff
  finally
  FreeAndNil(IFile);
  end;
end;

reddarin =)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question