How to get capture input events from keyboard and mouse

Hi,

Is there any way to capture/record the input events from keyboard, as well as from mouse using C.

Thanks in advance

What OS? Are you trying to write a device driver or a low level hook? Or, do you want to use high level apis and capture events for your applications? Are you working in the context of a GUI?

I'm trying to capture the mouse and keyboard events while doing operations.
Please help me out

I might be able to help work through this, but honestly, it's not something that I've done before in a Linux environment.
Are you using the KDE or Gnome?

Trying to capture keyboard and mouse events in gnome (ubuntu)