Solved

Getting Windows temp directory

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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