It would help to see the exact code and output from a
failure. I still don't understand 100% but it sounds
like your failure is on the read side -- that you try
reading from the device and get an empty "line". In
the first read examples, you're opening the device with
O_NDELAY. If I remember correctly, on most *nix
systems, the way that behaves with a terminal device
is that it returns nothing if nothing is available on the
terminal at the time of the read. It seems like that behavior may be matching exactly what you're seeing. I also
believe that an open using O_NDELAY may itself
return immediately, before the terminal device is ready,
which could cause problems that only show up when timing
In general, reading
directly from terminal devices like this is tricky and error
prone. So you may want to revisit exactly what it is you're
trying to achieve -- something else I can't really gather
from the example so far. The last open is cat'ing the
terminal device and reading from that output. That should
do almost the same thing the opens before it are attempting, but it
should avoid the O_NDELAY issues ... I think.
It would help to know the context the terminal device is
bneing read in -- what's being typed there, how that device
relates to the one the program is running on, etc.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||