Solved

Get windows temporary directory ( Easy )

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

Technology Partners: 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

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…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 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