Solved

Get windows temporary directory ( Easy )

Posted on 1998-08-20
3
178 Views
Last Modified: 2010-04-04
I want to get windows enveronment such as temporary directory and path. If there is more variables it's okay and I'll be thankfull for telling me.

comment :

I nead Delphi equevelant of pascal command :
GetEnv('Path');

Motaz, from Sudan
0
Comment
Question by:Motaz
3 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
ID: 1337286
Use the GetTempPath API.

The return value will include the final slash if it's a root directory, and no final slash if it's not.

Therefore to make it consistent for me to handle, in whatever language I'm in, I do the following algorithm

1. GetTempDir
2. Check if last char is \
3. If last char is not \ then add one (assuming I always want a final slash, could do the reverse if I never want one)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1337287
here is an example that displays a message box telling you the path to the temp folder
var
  Buffer : array[0..255]of char;
begin
  GetTempPath(StrLen(Buffer),Buffer);
  ShowMessage(Buffer);
end;

Hope this helps...

Regards,
Viktor Ivanov
0
 
LVL 7

Author Comment

by:Motaz
ID: 1337288
Thanks Viktor
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now