Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Get user Temp directory

Reply
Thread Tools

Get user Temp directory

 
 
Najd
Guest
Posts: n/a
 
      04-13-2006
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 ?

 
Reply With Quote
 
 
 
 
Howard
Guest
Posts: n/a
 
      04-13-2006

"Najd" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      04-13-2006
Najd wrote:
> 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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
Michiel.Salters@tomtom.com
Guest
Posts: n/a
 
      04-14-2006

Najd wrote:
> 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

 
Reply With Quote
 
Najd
Guest
Posts: n/a
 
      04-17-2006
Thanks.

 
Reply With Quote
 
Najd
Guest
Posts: n/a
 
      04-17-2006
Thanks Michiel.

 
Reply With Quote
 
Najd
Guest
Posts: n/a
 
      04-17-2006
Thank U.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? PerlFAQ Server Perl Misc 0 04-26-2011 10:00 AM
How to initialize member reference with temp object and delete the temp object when the destructor is called? PengYu.UT@gmail.com C++ 2 05-09-2005 05:48 PM
XP: Can't log on as a regular user, I get TEMP USER? lbbss Computer Support 0 02-11-2005 05:41 PM
File::Temp: opening the temp. file in "r+" mode? Also "man in the middle" A. Farber Perl Misc 3 03-03-2004 12:42 PM
Temp Internet and temp files now in winnt directory w2k pro Bibble Bobble Computer Support 1 11-27-2003 06:14 PM



Advertisments