Get user Temp directory

N

Najd

Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentVariable() and
ExpandEnvironmentStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Temp".
Did someone have another method or can explain me why it returns this
path instead of the user path "C:\Documents and Settings\user\local
settings\Temp".
Note:
When I used this 3 methods returns the right path in a Win32 console
application ?
 
H

Howard

Najd said:
Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentVariable() and
ExpandEnvironmentStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Temp".
Did someone have another method or can explain me why it returns this
path instead of the user path "C:\Documents and Settings\user\local
settings\Temp".
Note:
When I used this 3 methods returns the right path in a Win32 console
application ?

You need to ask on a windows newsgroup. Check the news.microsoft.com server
for available groups. (Or do a search on Google... I'd bet it's been asked
and answered before.)

-Howard
 
V

Victor Bazarov

Najd said:
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentVariable() and
ExpandEnvironmentStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Temp".

Whatever. Neither of those functions has anything to do with Standard
C++ language. I will take your word as to their behaviour.
Did someone have another method or can explain me why it returns this
path instead of the user path "C:\Documents and Settings\user\local
settings\Temp".

Yes, somebody in a Windows programming forum (newsgroup) undoubtedly has
some suggestions. Post there please. Here your question is off-topic.
Note:
When I used this 3 methods returns the right path in a Win32 console
application ?

Is that a question.

V
 
M

Michiel.Salters

Najd said:
Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentVariable() and
ExpandEnvironmentStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Temp".

The C++ way to get the "TEMP" environment variable is
std::getenv("TEMP");
That works for me.

OT note: on some systems, the system temp path is the only temp path,
and C++ can't do anything about it. If the user wants it that way,
don't argue.

HTH,
Michiel Salters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top