Thread: Accessing the 'home' directory path?

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    Maine
    Posts
    11

    Accessing the 'home' directory path?

    How can I access the default home directory from a program, so that I can call chdir() on that directory?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > How can I access the default home directory from a program
    Which OS and compiler?

    Also, do you mean
    - the home dir of the person who owns the program
    - the home dir of the person running the program
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Location
    Maine
    Posts
    11
    I'm using Cygwin and gcc as my compiler. Basically, I want to use the directory that the terminal starts in whenever a new one is loaded.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    11
    Use getenv("HOME")

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  2. Problem in accessing root home folder....
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 02-13-2008, 05:50 AM
  3. Not able to access directory of home folder
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 02-06-2008, 02:45 AM
  4. how to get current user home directory
    By George2 in forum Linux Programming
    Replies: 4
    Last Post: 05-08-2007, 02:46 PM