News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Get The Windows Temp Folder of the Current User

Started by kevin, December 03, 2008, 05:05:59 PM

Previous topic - Next topic

kevin

 
This example returns the windows temp folder of the current user.


Related To:
Get Special Windows Folders


PlayBASIC Code: [Select]
LinkDll "kernel32"
GetTempPathA(nSize,lpBuffer) alias "GetTempPathA" as integer
EndLinkDll



Function GetTempPath()
// Alloc a bank of 1024 bytes
Size=1024
ThisBank=newbank(Size)
Ptr=GetBankPtr(thisBank)
Status=GetTempPathA(Size,ptr)
if Status
Path$=PeekString(ptr,0) ; peek a null termed string
endif
Deletebank ThisBank
EndFunction path$


//
print GetTempPath()
Sync
waitkey