Thank you for your help.
On my PC your code returns the same value as sys(2023). Are you suggesting that your code returns name of the TEMP directory more consistently than sys(2023)?
>
>#DEFINE MAX_PATH 260
>
>DECLARE INTEGER GetTempPath IN kernel32;
> INTEGER nBufferLength, STRING @lpBuffer
>
>DECLARE INTEGER GetLongPathName IN kernel32;
> STRING lpszShortPath, STRING @lpszLongPath, INTEGER cchBuffer
>
>? GetLongTempPath()
>
>FUNCTION GetLongTempPath
> LOCAL cPath, cLongPath, nBufsize
> cPath = Repli(Chr(0),MAX_PATH)
> cLongPath = Repli(Chr(0),MAX_PATH*2)
> nBufsize = GetTempPath(Len(cPath), @cPath)
> cPath = LEFT(cPath, nBufsize)
> = GetLongPathName(cPath, @cLongPath, Len(cLongPath))
>RETURN SUBSTR(cLongPath, 1,AT(Chr(0),cLongPath)-1)
>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham