Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 12-18-2006, 07:32 AM
kate kate is offline
Senior Member
Join Date: Feb 2001
Posts: 356
Default Best way to get Windows Temp Directory

I got two code snippet for getting windows temp directory. I just want your expert comment as to which one will work best and why. If there is a better one, do please quote. Should apply to both Administrator and non-administrator login on all windows version. Thank you for your assistance:

function GetTempDirectory: String;
tempFolder: array[0..MAX_PATH] of Char;
GetTempPath(MAX_PATH, @tempFolder);
result := StrPas(tempFolder);

{================================================= =======}

function WindowsTemp : String;
Buffer : Array[0..Max_path] of char;
FillChar(Buffer,Max_Path + 1, 0);
GetTempPath(Max_path, Buffer);
Result := String(Buffer);
if Result[Length(Result)] <> '\' then Result := Result + '\';
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 09:56 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.