Query NT 4 to find %tmp% path

how can I find out what the tmp path is on any given  NT machine.

I have a program that writes to a tmp file so I need to
put this file in %tmp%.

Is there a win32 api call?
Who is Participating?
gindeConnect With a Mentor Commented:
If you are using NT 4.0, there should be environment variables TMP and TEMP. You can get their values using Environ("TEMP") function.

One comment: If Environ("TEMP") returns a null string, that system variable (temp) is not defined.

Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Const MAX_PATH = 256
Function TmpPath() as String
Dim strTemp As String * MAX_PATH
GetTempPath MAX_PATH, strTemp
TmpPath = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
End Function
greAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.