Link to home
Start Free TrialLog in
Avatar of begin
begin

asked on

string substitution


  char* usr = getlogin() ;
  ifstream in("/var/mail/   <output here>  ") ;

I want to substitute the output of getlogin() in the above ifstream, how shoud i, helps please
--begin.
ASKER CERTIFIED SOLUTION
Avatar of KangaRoo
KangaRoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

I strongly recommend the 2nd approach, but would change it to

std::string FilNam  = "/var/mail/";
FilNam += getlogin();
ifstream in(FilNam.c_str());

for readability.
Avatar of begin

ASKER

thanks for your solutions.