GetTempPath() function ...

GetTempPath() function ...

Postby Rimantas » Wed Feb 08, 2012 6:01 am

Hi ,

In one source , not mine , exist this function . But MinGW linker direct that this function is undefined . Maybe this can be changed with other , smilar function ?

With best regards !
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: GetTempPath() function ...

Postby anserkk » Wed Feb 08, 2012 6:14 am

GetEnv("TEMP")

May be useful for others

Code: Select all  Expand view
#Include "FiveWin.ch"
#Include "xBrowse.ch"
Function Main()
    Local aArr
   
    aArr:={ ;
            {"Temp"                   , GetEnv("TEMP")                   },;
            {"WinDir"                 , GetEnv("WINDIR")                 },;
            {"SystemRoot"             , GetEnv("SYSTEMROOT")             },;
            {"AllUsersProfile"        , GetEnv("ALLUSERSPROFILE")        },;
            {"UserProfile"            , GetEnv("USERPROFILE")            },;
            {"LocalAppData"           , GetEnv("LOCALAPPDATA")           },;
            {"AppData"                , GetEnv("APPDATA")                },;
            {"ProgramFiles"           , GetEnv("ProgramFiles")           },;
            {"CommonProgramFiles"     , GetEnv("CommonProgramFiles")     },;
            {"HomeDrive"              , GetEnv("HOMEDRIVE")              },;
            {"HomePath"               , GetEnv("HOMEPATH")               },;
            {"LogonServer"            , GetEnv("LOGONSERVER")            },;
            {"ComputerName"           , GetEnv("ComputerName")           },;            
            {"Path"                   , GetEnv("PATH")                   },;
            {"OS"                     , GetEnv("OS")                     },;
            {"SessionName"            , GetEnv("SESSIONNAME")            },;  
            {"UserName"               , GetEnv("USERNAME")               },;              
            {"Processor_Architecture" , GetEnv("PROCESSOR_ARCHITECTURE") },;
            {"Include"                , GetEnv("INCLUDE")                },;
          }
         
    XBrowser aArr          
           
Return NIL
 

Image

Regards
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: GetTempPath() function ...

Postby hmpaquito » Wed Feb 08, 2012 10:09 am

Amigos,

Code: Select all  Expand view

#Define CRLF Chr(13)+ Chr(10)
//-------------------------------------------------------------------------//
// Para conocer todas las variables de entorno
FUNCTION GetOSEnvironment()
Local cTmp:= "TMPENV$$.Txt"
Local aTmp
Local aEnv:= {}
Local nI
Local cNombre, cValor, nAt
Local cBat:= "BATENV$$.Bat"
Local cComando:= "SET > "+ cTmp
Local hBat
*

hBat:= FCreate(cBat)
FWrite(hBat, cComando)
FClose(hBat)
*
RUN (cBat)
*
aTmp:= Cad2Arr(MemoRead(cTmp), CRLF)
*
FOR nI:= 1 TO Len(aTmp)
   nAt:= At("=", aTmp[nI])
   cNombre:= Left(aTmp[nI], nAt- 1)
   cValor:= SubStr(aTmp[nI], nAt+ 1)
   aAdd(aEnv,{cNombre, cValor})
NEXT
RETURN aEnv
*
//-------------------------------------------------------------------------//
// Funcion sin testear
STATIC FUNCTION Cad2Arr(cCadena, cSeparador)
Local nPos, aCadena:= {}, cSub

nPos:= At(cSeparador, cCadena)

do while nPos != 0
   cSub:= substr(cCadena, 1, nPos- 1)
   Aadd(aCadena, cSub)
   cCadena:= substr(cCadena, nPos+ Len(cSeparador))
   nPos:= At(cSeparador, cCadena)
enddo

cSub:= Left(cCadena, Len(cCadena))
Aadd(aCadena, cSub)

RETURN aCadena
*
 


Saludos
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: GetTempPath() function ...

Postby Rimantas » Thu Feb 09, 2012 7:22 pm

anserkk wrote:GetEnv("TEMP")

May be useful for others
Anser



Many thanks Anser ! :)
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 91 guests