Solved

Getting Windows temp directory

Posted on 2000-05-13
2
328 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
  • 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

10 Experts available now in Live!

Get 1:1 Help Now