Mar 17, 2004 #1 room24 Programmer Joined Dec 28, 2003 Messages 83 Location JM how do actually use opendir() to open someone's home directory. what value would you pass to opendir on unix to make it open the home directory
how do actually use opendir() to open someone's home directory. what value would you pass to opendir on unix to make it open the home directory
Mar 17, 2004 #2 itsgsd Programmer Joined Sep 4, 2002 Messages 163 I believe that this is what you are asking. You can get the user's home directory by reading the environment variable 'HOME'. Like this: Code: char *homedir; DIR *dir; homedir = getenv ( "HOME"); if (NULL == homedir) {} // do something else dir = opendir(homedir); Hope this helps. Upvote 0 Downvote
I believe that this is what you are asking. You can get the user's home directory by reading the environment variable 'HOME'. Like this: Code: char *homedir; DIR *dir; homedir = getenv ( "HOME"); if (NULL == homedir) {} // do something else dir = opendir(homedir); Hope this helps.