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 .
mtmp:=Getenv("TEMP")
-
- Posts: 22
- Joined: Fri Nov 04, 2005 9:05 pm
- Location: LIEGE Belgium
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: mtmp:=Getenv("TEMP")
It depends on local settings. In my XP I get c:\documents and setting ... It is the default setting.
EMG
EMG
-
- Posts: 22
- Joined: Fri Nov 04, 2005 9:05 pm
- Location: LIEGE Belgium
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
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"
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 9:05 pm
- Location: LIEGE Belgium
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
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:
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:
Code: Select all
#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"