Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
int main(){ int fd, bytes; unsigned char data[3]; //set mouse device location const char *mouseDevice = "/dev/input/mice"; // Open Mouse as Read Only fd = open(mouseDevice, O_RDONLY); if(fd == -1){ printf("ERROR Opening %s\n", mouseDevice); printf("You may not have permission to read from this device.\n"); return -1; } int l, m, r; signed char x, y; while(1){ // Read Mouse bytes = read(fd, data, sizeof(data)); if(bytes > 0){ l = data[0] & 0x1; r = data[0] & 0x2; m = data[0] & 0x4; x = data[1]; y = data[2]; /*action if left mouse button is clicked if(l == 1){ printf("Left Mouse Button Clicked.\n"); } */ printf("x=%d, y=%d, l=%d, m=%d, r=%d\n", x, y, l, m, r); } } return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)