Get user Temp directory

Discussion in 'C++' started by Najd, Apr 13, 2006.

  1. Najd

    Najd Guest

    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 ?
     
    Najd, Apr 13, 2006
    #1
    1. Advertising

  2. Najd

    Howard Guest

    "Najd" <> wrote in message
    news:...
    > 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
     
    Howard, Apr 13, 2006
    #2
    1. Advertising

  3. 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
     
    Victor Bazarov, Apr 13, 2006
    #3
  4. Najd

    Guest

    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
     
    , Apr 14, 2006
    #4
  5. Najd

    Najd Guest

    Thanks.
     
    Najd, Apr 17, 2006
    #5
  6. Najd

    Najd Guest

    Thanks Michiel.
     
    Najd, Apr 17, 2006
    #6
  7. Najd

    Najd Guest

    Thank U.
     
    Najd, Apr 17, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    577
    Mark P
    May 9, 2005
  2. Replies:
    2
    Views:
    552
    Roedy Green
    Dec 24, 2007
  3. Alberto Bignotti

    get temp directory

    Alberto Bignotti, Feb 28, 2008, in forum: C++
    Replies:
    3
    Views:
    617
    James Kanze
    Feb 28, 2008
  4. A. Farber
    Replies:
    3
    Views:
    266
    Ben Morrow
    Mar 3, 2004
  5. PerlFAQ Server
    Replies:
    0
    Views:
    262
    PerlFAQ Server
    Apr 26, 2011
Loading...

Share This Page