Home » Questions » Computers [ Ask a new question ]

What is "~/" directory?

What is "~/" directory?

Maybe not programming related, but I want to reference this directory in c program.

Asked by: Guest | Views: 52
Total answers/comments: 2
Guest [Entry]

"Maybe not programming related, but I
want to reference this directory in c
program.

If you try to opendir the string literal ""~/"" in C, you'll find it doesn't exist. It is a Bash/Csh shorthand notation that is expanded by the shell to the home directory. It does not exist as such on the filesystem and so a C program will fail- unless it invokes Bash, for example, and allows Bash to expand the string."
Guest [Entry]

It is $HOME, but changing it's value will not effect expansion. See this link for more information.