in reply to Re^2: Wierd File pipe problem...
in thread Wierd File pipe problem...
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 changes.
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Wierd File pipe problem...
by bferlin (Acolyte) on Dec 21, 2004 at 16:57 UTC | |
Re^4: Wierd File pipe problem...
by bferlin (Acolyte) on Dec 21, 2004 at 15:32 UTC |