'How to detect when Ctrl+R or tab is pressed on linux?

I am trying to code a custom shell implementation in C++ for linux. In that, I have to implement a functionality which will run when Ctrl+R is pressed, and another when the Tab key is pressed. How do I detect when these two keys are pressed in C++? For Ctrl+C and Ctrl+Z, I used signal() function, but I am at a loss about what to do for these two.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source