FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper mtmp:=Getenv("TEMP")
Posts: 22
Joined: Fri Nov 04, 2005 09:05 PM
mtmp:=Getenv("TEMP")
Posted: Fri Jun 30, 2006 11:57 AM

I use this function and do'nt receive the same result.

Under win2000 it return the temp directory of the user c:\documents and setting .....

Under Win XP it return c:\windows\temp

How to return the temp directory of the user with WinXp .

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: mtmp:=Getenv("TEMP")
Posted: Fri Jun 30, 2006 02:55 PM

It depends on local settings. In my XP I get c:\documents and setting ... It is the default setting.

EMG

Posts: 22
Joined: Fri Nov 04, 2005 09:05 PM
mtmp:=Getenv("TEMP")
Posted: Fri Jun 30, 2006 07:35 PM

With Fivewin and clipper , it return c:\windows\temp

With xharbour and fivewin, it return c:\documents and setting ....

Strong ! 16 and 32 bit !!

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
mtmp:=Getenv("TEMP")
Posted: Fri Jun 30, 2006 09:35 PM

Ops, I was not aware to be in the Fivewin for Clipper forum. Yes, I tried with FWH. With Clipper I get c:\windows\temp.

EMG

Posts: 21
Joined: Wed Nov 23, 2005 12:24 AM
mtmp:=Getenv("TEMP")
Posted: Sun Jul 02, 2006 03:51 PM

Or you can use the following API call to get the windows temp folder
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"

Posts: 22
Joined: Fri Nov 04, 2005 09:05 PM
mtmp:=Getenv("TEMP")
Posted: Tue Jul 04, 2006 08:04 AM

I have the same result with the api,
it return windows\temp and not the user tem path .

??

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
mtmp:=Getenv("TEMP")
Posted: Tue Jul 04, 2006 07:01 PM
Philippe,

It is a Windows issue. Under 16 bits GetEnv( "TEMP" ) returns "c:\windows\temp" and under 32 bits GetEnv( "TEMP" ) return "c:\documents and settings\<username>\...\temp"

Even if you try it this way, you get the different results:
#include "FiveWin.ch"

function Main()

   local cValue := Space( 256 )

   MsgInfo( GetEnv( "TEMP" ) )
   
   GetEnvironmentVariable( "TEMP", cValue, Len( cValue ) )
   
   MsgInfo( cValue )
   
return nil 

DLL32 FUNCTION GetEnvironmentVariable( cName AS LPSTR, cValue AS LPSTR, nLen AS LONG ) ;
   AS LONG PASCAL FROM "GetEnvironmentVariableA" LIB "kernel32.dll"
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 21
Joined: Wed Nov 23, 2005 12:24 AM
mtmp:=Getenv(&quot;TEMP&quot;)
Posted: Wed Jul 05, 2006 05:42 PM
jacquet philippe wrote:I have the same result with the api,
it return windows\temp and not the user tem path .

??


That's strange under Win 2000 i get the user temp path, I am however logged in as an admin of the local machine.

Continue the discussion