fread with a pipe and a skip

John W. Eaton jwe at octave.org
Wed Mar 11 19:12:19 CDT 2009


On 11-Mar-2009, spasmous wrote:

| I have a code snippet below that reproduces what may be a bug. Basically,
| when freading from a pipe and using the skip argument, the pipe is not fully
| read in. Results for running the code on my system (3.03) are:
| 
| octave:7> mytest
| done = 1111 2222 3333 4444 5555 6666
| done = 111122223333444455556666
| done = 1111 2222 3333 4444 5555 6666
| done = 1111
| octave:8>

Skipping is currently implemented by calling seek.  That's not
reliable when reading from a pipe.  Should we fix it by reading
instead of seeking?  That could work for reading, but what about
writing?  I don't think we want to actually write anything when
skipping, so I don't see a solution to handling skip for writing  Or
should we just print a warning (or fail with an error) if skip is not
zero when the stream is a pipe (whether open for reading or writing)?

jwe


More information about the Bug-octave mailing list