How can I access the default home directory from a program, so that I can call chdir() on that directory?
How can I access the default home directory from a program, so that I can call chdir() on that directory?
> 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'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.
Use getenv("HOME")