Filenames with tilde
I want to open a file with a filename that starts with ~ so that it is created/opened in the users home directory.
But when I try to do that it fails with "No such directory".
I would have thought that this was a common requirement. So is there a handy library function that exists to convert the tilde into the users home directory path.
If not, and I have to do the conversion myself, what routines exist to get hold of the HOMEDIR variable.
All in "C" by the way.
i dont know if theres a lib to automatically convert ~ to users home dir, but if you want to do it yourself and want to get hold of teh HOME, then you will have to use "environ"
use teh declaration as
extern char **environ;
and then get teh HOME var.
Thanks. I'm now decoding the environment variables and that seems to do what I want.
|All times are GMT -5. The time now is 06:31 PM.|