How can find a temp folder where the current user has the access right

How can find a temp folder where the current user has the access right?
My application will generate template html files in a temp folder under the application path (usually, administrator user installed it in "C:\Program Files\BillcchApp"), but some of users don't have the access right on the application folder. How can I find the path that current user has the access right.... using GetTempPath() API can handle this job or not?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would imagine that it could, yes.  Reading the dox on the subject,
"The GetTempPath function checks for the existence of environment variables in the following order and uses the first path found:

   1. The path specified by the TMP environment variable.
   2. The path specified by the TEMP environment variable.
   3. The path specified by the USERPROFILE environment variable.
   4. The Windows directory.
paying attention to #3.

You can always test for failure, and then create another temporary directory somewhere else of your choosing if required.

Alternatively, why not just create a folder that all users can have access to, and dump your HTML there ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
billcchAuthor Commented:
why not just create a folder that all users can have access to, and dump your HTML there ?
I like to...
but which folder that all users can have access?
how can I get it?
You could always create a folder under "All users"; C:\\Documents and Settings\\All Users

I even think that it would not be an issue having several copies of the HTML files in each of the user's own space; HTML is only KB at the most.

But I would go with the "All users" option personallyl
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

billcchAuthor Commented:
How about Win98?...
There is no C:\\Documents and Settings\\All Users folder...
shold I need to check which OS (98/me/2000/nt/xp) user are using...
One thing is very important for me...
once the C++ generate the temp html file, the c++ code need to let a javascript program to know
where the temp file located...
my original design that c++ write down the full path into an ini file which locate in "APPLICATION FOLDER", but user might not have the access right, so the full path information will never pass to the javascript program...
Please help me...
billcchAuthor Commented:
PS... I don't know how to let javascript find the temp folder (the same folder that I can get from VC++)...
You could always have the user browse to find a suitable directory, then write this in the registry and use it again at a later date.  A convenient place to do this would be on the first run of your application, as part of the install.
billcchAuthor Commented:
Thanks, sorry I went to business trip, and did not have chance back to ee to thanks you guys.
Thanks again!
Glad to help :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.