Solved

Get windows temporary directory ( Easy )

Posted on 1998-08-20
3
179 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

17 Experts available now in Live!

Get 1:1 Help Now