Kiri3L

Untitled

Nov 26th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //
  2. // Created by k3l on 22.11.2019.
  3. //
  4.  
  5. #include <iostream>
  6. #include <csignal> // или signal.h
  7. using namespace std;
  8.  
  9. void signal_handler_name(int i){ } // функция затычка
  10.  
  11.  
  12.  
  13. int main() {
  14. // sigignore(SIGINT); // Ctrl + C
  15. // sigignore(SIGTSTP); // Ctrl + Z Эти две строки работают на linux и заменяют все остальное
  16.  
  17. signal(SIGINT, signal_handler_name); // затыкаем этой функцией все, что попадется под руку
  18. signal(SIGTERM, signal_handler_name);
  19. signal(SIGABRT, signal_handler_name);
  20. signal(SIGTSTP, signal_handler_name);
  21. // Дальше любой код
  22. string s;
  23. while (true){
  24. cin >> s;
  25. cout << "\n" << s << "\n";
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment