happi has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to capture data from a linux device file; in the form:
------------------------------#!/../../perl -w open(FF, "< /dev/mouse") || die "cannot open handle \n"; while (<FF>) { $vr = $_; print $vr; } close (FF);
I keep getting the error "readline() on closed filehandle FF on line 3"
I've tried this with /dev/ttyS1 , /dev/usb/USB/scanner0 and /dev/fd0
This works fine if I use a test file, like :
Also, I tried this in the form: sysopen(FF, "/dev/fd0", O_RDONLY); but I always get the error that says "item O_RDONLY isn't numeric at line 3"open(FF, "< /path/to/file.txt" );
Why doen't the sysopen work ? why does the device file always seem closed or non-existent ?
I am using Linux 9 and Perl 5.8 . I would hope not to need any Perl modules for something this basic... Help Help..... Happi..
Edited by Chady -- code tags and minor formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Linux device filehandle roadblock
by amw1 (Friar) on Jun 11, 2004 at 18:42 UTC | |
|
Re: Linux device filehandle roadblock
by pbeckingham (Parson) on Jun 11, 2004 at 18:09 UTC | |
by Fletch (Bishop) on Jun 11, 2004 at 18:17 UTC | |
by happi (Initiate) on Jun 15, 2004 at 19:40 UTC | |
|
Re: Linux device filehandle roadblock
by zentara (Cardinal) on Jun 12, 2004 at 15:24 UTC |