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 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. Dunsavage
-----------------------------------------------
| http://south.bestsites.net/~dunny/index.htm |
| http://www.geocities.com/area51/zone/6305   |
-----------------------------------------------


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.



--
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with
                       "unsubscribe" as the Subject.

Reply via email to