This is how it works:

ifstream list("../../../.Alarm_clock/output.txt"); 

So - no:

 ifstream list("$HOME/.Alarm_clock/output.txt"); 
  • five
    Does $HOME automatically open up on the way? It seemed to me that this shell does :) - Harry

1 answer 1

As far as I can judge about Linux (I'm not too knowledgeable in it), $HOME is an indication for the shell to substitute the value of the HOME environment variable. What the ifstream constructor naturally does not do.

Use the appropriate function - as I understand it, getenv("HOME") , and collect the full path to the file.