I'm trying to make 2 different programs - one that will write notes to a note file, and one that will read the notes. These two programs are called Notes and Noteread. Here is the source code for these programs.
// notes.cpp
include <iostream>                                                              
#include <fstream>                                                               
#include <ctime>                                                                 
using namespace std;                                                             
int main () {                                                                    
    time_t now = time(0);                                                        
    char* dt = ctime(&now);                                                      
    ofstream myfile;                                                             
    std::cout << ": ";                                                           
    string x{};                                                                  
    std::cin >> x;                                                               
    myfile.open ("~/notes.txt", ios_base::app);                                  
    myfile << "---- " << dt;                                                     
    myfile << x << '\n';                                                         
    myfile << "\n";                                                              
    myfile.close();                                                              
    return 0;                                                                    
}                                                                                
// noteread.cpp
#include <bits/stdc++.h>                                                         
int main() {                                                                     
    system("less ~/notes.txt");                                                  
}                                                                                
It's supposed to work like this.
jingle@variable [time] [~/notes] [master *]
-> % notes
: hello
jingle@variable [time] [~/notes] [master *]
-> % noteread
( less program)
--- time
hello
jingle@variable [time] [~/notes] [master *]
-> %
Although it ends up doing this:
jingle@variable [time] [~/notes] [master *]
-> % notes
: hello
jingle@variable [time] [~/notes] [master *]
-> % noteread
/home/jingle/notes.txt: No such file or directory
jingle@variable [time] [~/notes] [master *]
-> %
Another thing i did to debug this is make the notes.txt file and then run the program, but that turns out once running the program like i did above noteread finds the file but the file's blank. This is really weird and beyond my knowledge. Thanks in advance!
 
    