Solved

Get windows temporary directory ( Easy )

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

726 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