Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Linux device filehandle roadblock

by amw1 (Friar)
on Jun 11, 2004 at 18:42 UTC ( [id://363496]=note: print w/replies, xml ) Need Help??


in reply to Linux device filehandle roadblock

this appears to work:

or at least stuff is output. I've never used the POSIX::read/open stuff before so there may be holes I didn't catch.

did the sprintf stuff to get the hex stream rather than unprintable garbage. May not work the way I think it does. :)
+ use strict; my $data; my $fd; my $buf; use POSIX; $fd = POSIX::open("/dev/mouse", &POSIX::O_RDONLY) || die ($!); while($data = POSIX::read($fd, $buf, 1)) { print "READ $data Bytes: " . join("", map(sprintf("%x",ord($_)), sp +lit(//, $buf))) . "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://363496]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-29 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found