Try something like:
char fname[2048]; // maybe dynamically allocate
char *home = getenv("HOME");
sprintf(fname, "%s//book.txt", home);
outfile.open(fname, ios::out);
#Thanks,
#Matt Smith
#==
#[EMAIL PROTECTED]
>>> <[EMAIL PROTECTED]> 05/12 6:40 PM >>>
I want to write to a fi
> outfile.open ("//usr//address//book.txt", ios::out); // Opens
book.txt
It is unnecessary to double up the slashes.
>
> but i want it to open to say my dunny dir or my msd dir...and then
make
> the dir/file
>
> how?
>
Michael S. Dunsavage wrote:
>
> I want to write to a file in a home directory..but i want each user to
> write the file to his/her dir
have you tried using ~? (= user's home directory; e.g. my login file can
be referenced with ~/.login.)
--
PLEASE read the Red Hat FAQ, Tips, Errata and the
I want to write to a file in a home directory..but i want each user to
write the file to his/her dir
outfile.open ("//usr//address//book.txt", ios::out); // Opens
book.txt
but i want it to open to say my dunny dir or my msd dir...and then make
the dir/file
how?
Michael S. Dunsav