Solved

Getting Windows temp directory

Posted on 2000-05-13
2
334 Views
Last Modified: 2012-05-04
Is there a way to return the local computer's Windows temp directory besides GetTempPathA (which has been given me the most illogical errors in my code)?  It works and returns the right path, but absolutely makes my code go nuts.
0
Comment
Question by:uhoang
[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
2 Comments
 
LVL 15

Accepted Solution

by:
simonet earned 50 total points
ID: 2807860
Here it is:

function GetTempPathStr : string;
var
  pTempPath : pchar;
begin
  pTempPath := StrAlloc(MAX_PATH + 1);
  GetTempPath(MAX_PATH+1, pTempPath);
  Result := string(pTempPath)
  StrDispose(pTempPath);
end;


Now just use the function GetTempPathStr whenever you need the Temp path.

Yours,

Alex
   
0
 
LVL 15

Expert Comment

by:simonet
ID: 2814966
Why a B if the routine works fine?

Alex
0

Featured Post

Independent Software Vendors: 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

Title # Comments Views Activity
Delphi 2 89
Not able to call Delphi XE10 dll function from Delphi 6.0 4 55
Firemonkey BASS_Init into a thread 17 79
Posting a string with PostMessage 23 47
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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

737 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