I wanted to write a console notebook application which gets text from the user and saves it in .txt file. So, for inputting the text, I am using a while-loop:
while (getline(std::cin, line)) {
myfile << line << "\n";
}
If the user is done writing the text, he/she must do something so the loop breaks. I have found something called signal handling, but do not know how to implement it in my code. I also tried SetConsoleCtrlHandler from Microsoft. How can I get the use of it, or are there any other ways to do the given task?