function that return the temp directory of the logged user

Postby James Bott » Tue Mar 14, 2006 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Tue Mar 14, 2006 5:34 pm

Agreed.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Vladimir Grigoriev » 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
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Postby Mdandrea » 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"
Mdandrea
 
Posts: 21
Joined: Wed Nov 23, 2005 12:24 am

Previous

Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 8 guests