FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper function that return the temp directory of the logged user
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
function that return the temp directory of the logged user
Posted: Tue Mar 14, 2006 05:13 PM

Enrico,

There is a downside to putting temp files in the current directory when the program is being run from a server. This slows down the application.

It might be better (when TEMP isn't found) to check for c:\temp and if it doesn't exist, then create it and use this instead.

I know most Windows versions have a c:\windows\temp but some versions have security which won't allow users write access to it.

There is also an upside to using the server to hold temp files, and that is that any orphan temp files can be periodically deleted either by the application or an administrator.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
function that return the temp directory of the logged user
Posted: Tue Mar 14, 2006 05:34 PM

Agreed.

EMG

Posts: 54
Joined: Fri Oct 21, 2005 10:45 AM
function that return the temp directory of the logged user
Posted: Wed Mar 15, 2006 12:54 PM

After reading I can conclude that idea to have a program parameter which specifies a temp directory (for example, MyProg /TMP:c:\somepath) deserves consideration. :D

Posts: 21
Joined: Wed Nov 23, 2005 12:24 AM
function that return the temp directory of the logged user
Posted: Wed Mar 22, 2006 10:47 PM

Or you can use the following API call to get the windows temp folder IF they have access to it.

function get_temp()
local tbuffer:=space(256)

gettemppath(256,@tbuffer)
tbuffer := LEFT(tbuffer,AT(CHR(0),tbuffer)-1)
return(tbuffer)

DLL32 Function GetTempPath( bufferlen as LONG, tbuffer AS LPSTR) AS LONG ;
PASCAL FROM "GetTempPathA" LIB "kernel32.dll"

Continue the discussion