Write a C program that doesn’t terminate when Ctrl+Z is pressed. It prints a message “Cannot be suspended using Ctrl+Z” and continues execution.
We can use Unix signal for this. When Ctrl+Z is pressed, SIGTSTP signal is generated.
SIGTSTP signal is sent to a process by its controlling terminal to request it to stop (terminal stop). We can catch this signal and run our own defined signal.
The standard C library function signal() can be used to set up a handler for any of the above signals.
Cannot execute Ctrl+Z
This article is contributed by Pramod Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Write a C program that does not terminate when Ctrl+C is pressed
- Why variable name does not start with numbers in C ?
- Why does sizeof(x++) not increment x in C?
- How does a C program executes?
- Does C support function overloading?
- How does "void *" differ in C and C++?
- Does C++ compiler create default constructor when we write our own?
- How does free() know the size of memory to be deallocated?
- When does compiler create default and copy constructors in C++?
- Does overloading work with Inheritance?
- How does Duff's Device work?
- What does main() return in C and C++?
- How does Volatile qualifier of C works in Computing System
- Bash program to check if the Number is a Prime or not
- 8085 program to check whether the given 16 bit number is palindrome or not
- 8085 program to determine if the number is prime or not
- 8085 program to check whether both the nibbles of 8 bit number are equal or not
- Program to check if two strings are same or not
- C program to check if a given string is Keyword or not
- 8086 program to check whether a string is palindrome or not