Putting stuff in $HOME (POSIX)

Discussion in 'C++' started by DanielESFA, May 23, 2005.

  1. DanielESFA

    DanielESFA Guest

    Hey :)

    How would I go about accessing the user's home folder without knowing the
    path? I was hoping I could simply use $HOME as in bash, but no donut...

    TIA,
    Daniel :)

    --
    Why do cats jump out of windows? Because there's love out there!
     
    DanielESFA, May 23, 2005
    #1
    1. Advertising

  2. On 2005-05-23, DanielESFA <> wrote:
    > Hey :)
    >
    > How would I go about accessing the user's home folder without knowing the
    > path? I was hoping I could simply use $HOME as in bash, but no donut...


    That's an easy question, but off topic here. try comp.unix.programmer or
    comp.os.linux.development.*

    --
    Donovan Rebbechi
    http://pegasus.rutgers.edu/~elflord/
     
    Donovan Rebbechi, May 23, 2005
    #2
    1. Advertising

  3. DanielESFA wrote:
    > Hey :)
    >
    > How would I go about accessing the user's home folder without knowing the
    > path? I was hoping I could simply use $HOME as in bash, but no donut...
    >
    > TIA,
    > Daniel :)
    >


    #include <cstdlib>
    #include <iostream>

    int main()
    {
    char *home;

    home = getenv("HOME");

    if (home)
    std::cout << "HOME: " << home << std::endl;
    else
    std::cout << "HOME not found" << std::endl;

    return 0;
    }

    Regards,
    Larry

    --
    Anti-spam address, change each 'X' to '.' to reply directly.
     
    Larry I Smith, May 23, 2005
    #3
  4. DanielESFA

    DanielESFA Guest

    Larry I Smith wrote:

    > DanielESFA wrote:
    >> Hey :)
    >>
    >> How would I go about accessing the user's home folder without knowing the
    >> path? I was hoping I could simply use $HOME as in bash, but no donut...
    >>
    >> TIA,
    >> Daniel :)
    >>

    >
    > #include <cstdlib>
    > #include <iostream>
    >
    > int main()
    > {
    > char *home;
    >
    > home = getenv("HOME");
    >
    > if (home)
    > std::cout << "HOME: " << home << std::endl;
    > else
    > std::cout << "HOME not found" << std::endl;
    >
    > return 0;
    > }
    >
    > Regards,
    > Larry
    >


    Beautiful Larry! Thank you very much :)

    --
    Why do cats jump out of windows? Because there's love out there!
     
    DanielESFA, May 23, 2005
    #4
  5. DanielESFA wrote:
    >>

    > Beautiful Larry! Thank you very much :)
    >


    See 'man -S 3 getenv' for additional info.

    Larry

    --
    Anti-spam address, change each 'X' to '.' to reply directly.
     
    Larry I Smith, May 23, 2005
    #5
  6. DanielESFA

    DanielESFA Guest

    Larry I Smith wrote:

    > DanielESFA wrote:
    >>>

    >> Beautiful Larry! Thank you very much :)
    >>

    >
    > See 'man -S 3 getenv' for additional info.
    >
    > Larry
    >


    Already did, thanks :)

    --
    Why do cats jump out of windows? Because there's love out there!
     
    DanielESFA, May 23, 2005
    #6
    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. Saurabh
    Replies:
    6
    Views:
    4,543
    Chris Smith
    May 30, 2004
  2. Jeff Epler

    Re: HOME Directory in posix and nt

    Jeff Epler, Aug 3, 2003, in forum: Python
    Replies:
    1
    Views:
    690
    Jarek Zgoda
    Aug 3, 2003
  3. nancyflorida
    Replies:
    0
    Views:
    336
    nancyflorida
    Nov 12, 2007
  4. nancyflorida
    Replies:
    0
    Views:
    320
    nancyflorida
    Nov 12, 2007
  5. * Its my Pleasure *
    Replies:
    0
    Views:
    381
    * Its my Pleasure *
    Feb 20, 2008
Loading...

Share This Page