Subject: Re: Programming
To: Hubert Feyrer <Hubert.Feyrer@rz.uni-regensburg.de>
From: Tero Manninen <email@example.com>
Date: 01/09/1995 12:50:44
> > cd ~
> > my fopen command crashes with this line,
> > input=fopen("~/.quickconfig","r");
> > ktrace reports that it can't find the file ~/.quickconfig however, when
> > I do a:
> > man ~/.quickconfig
> > I can read the file. Does anybody know why this is happening? Thanks
> > for any reply. :)
> the '~' is interpreted by the shell just as *, ~, ... are. the Tilde-expansion
> didn't make it into Posix, so you can't use it. You'll have to find out the
> value of ~ yourself, maybe using getenv("HOME") or using getpwent().
If you have a directory called "~" (not your home directory!!) in the
current working directory and that contains the file ".quickconfig"
then your fopen() should work.
To my knowledge standard c-library file handling functions don't
expand any wild card.