Accessing the 'home' directory path?

This is a discussion on Accessing the 'home' directory path? within the C Programming forums, part of the General Programming Boards category; How can I access the default home directory from a program, so that I can call chdir() on that directory?...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,335
    > 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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 01:54 AM
  2. Problem in accessing root home folder....
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 02-13-2008, 04:50 AM
  3. Not able to access directory of home folder
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 02-06-2008, 01: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21