473,748 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get user Temp directory

Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentV ariable() and
ExpandEnvironme ntStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Tem p".
Did someone have another method or can explain me why it returns this
path instead of the user path "C:\Documen ts and Settings\user\l ocal
settings\Temp".
Note:
When I used this 3 methods returns the right path in a Win32 console
application ?

Apr 13 '06 #1
6 23265

"Najd" <na************ @yahoo.fr> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentV ariable() and
ExpandEnvironme ntStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Tem p".
Did someone have another method or can explain me why it returns this
path instead of the user path "C:\Documen ts and Settings\user\l ocal
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
Apr 13 '06 #2
Najd wrote:
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentV ariable() and
ExpandEnvironme ntStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Tem p".
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:\Documen ts and Settings\user\l ocal
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
Apr 13 '06 #3

Najd wrote:
Hi All,
I'm developping a DLL that requiers the path of the Temp directory of
the user logged. I used GetTempPath(), GetEnvironmentV ariable() and
ExpandEnvironme ntStrings(), but the 3 methodes returns the system temp
path: "C:\WINDOWS\Tem p".


The C++ way to get the "TEMP" environment variable is
std::getenv("TE MP");
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

Apr 14 '06 #4
Thanks.

Apr 17 '06 #5
Thanks Michiel.

Apr 17 '06 #6
Thank U.

Apr 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
399
by: Matthew Fitzpatrick | last post by:
My application has a settings class that is serialized to save and deserialized to load. I'm having a problem where i catch the WM_QUERYENDSESSION event via WinProc to save my application's settings when a user logs out, reboots or shuts down the system. The behavior of XmlSerializer is that it creates temporary dll's to do the (de)serialization in the system's temp directory. The behavior of windows on a system shutdown is to purge...
5
2664
by: Patrick | last post by:
Hello - I am working on a program that creates a small temp file. The ideal would be it creates the file in the user %temp% directory - whatever that is - the default is %USERPROFILE%\Local Settings\Temp. Is there an easy way to set a variable to the users %TEMP% directory in Visual Basic .NET?
2
2398
by: Lars Netzel | last post by:
I'm trying to write a PDF to disk on the server (crystal reports export) I'm getting aproblem that Access is denied to save the file to disk and reading here (you don't need to read): http://support.businessobjects.com/library/kbase/articles/c2010773.asp It says I should set the proper rights to the Destination and Temp directory... I know what the destionation directory is... but what is the temp directory? where is that?
2
1561
by: Scott Meddows | last post by:
How can I get the location of the temp directory for the current user? Thanks!
0
2361
by: Andrés G. Aragoneses | last post by:
When trying to use a webservices, not very often I obtain the following exception: Server was unable to process request. ---> Access to the temp directory is denied. Identity 'NT AUTHORITY\NETWORK SERVICE' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is using to do the compilation, so if the user doesnt have access to system temp...
0
4377
by: oritc123 | last post by:
Hello . I am having the following error when I run my application under Windows Vista ( it runs fine under Windows XP ) : "Access to the temp directory is denied. Identity 'ORITSLAPTOP\orit' under which XmlSerializer is running does not have sufficient permission to access the temp directory. CodeDom will use the user account the process is
3
5892
by: Alberto Bignotti | last post by:
How to get user temporany directory from c++ function? example: string myTempDir = getTempDir(); now myTempDir contains 'c:\tmp' is there a portable function?
6
1964
by: Aussie Rules | last post by:
Hi, In my application I need to write an XML file to disk, but am concerned that permission might be a problem. The file only needs to be written out and used for another reason and can then be deleted. I was thinking about using the windows/system temp directory as the location, as I guess that a directory where my application shouldn't have an
1
2491
by: Praveen St | last post by:
Hi, I need a perl script on windows which deletes the newline characters from a file and merges all the lines into one line and then write into another file in windows system %temp% directory. For example, this script is to delete newlines and create a sigle line and write into another file in %TEMP% I have script which deletes the newlines but the output goes to STDOUT I am not able to create a file in %TEMP% and redirect the...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.