Greetings,
I know you can read raw data from devices in linux... But is it first in best dressed?
For example, dump.txt remains blank in the following:
I know my mouse is in use by X but, should I be able to read the raw data too?Code:#include <stdio.h>
int main(void)
{
FILE * device, * out;
int cc;
if((device = fopen("/dev/input/mouse0", "rb")) == NULL)
{
perror("Failed to open the device");
return 1;
}
if((out = fopen("dump.txt", "wb")) == NULL)
{
perror("Failed to open dump.txt");
fclose(device);
return 1;
}
while(1)
{
cc = fgetc(device);
fputc(cc, out);
}
fclose(device);
fclose(out);
return 0;
}
What am I doing wrong?
Thanks in advance :)