help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [example] how to get popen2() working? [XP, MSVC 2.9.15-octave]


From: andreas.naessl
Subject: Re: [example] how to get popen2() working? [XP, MSVC 2.9.15-octave]
Date: Sat, 1 Dec 2007 17:23:01 +0100

> Basically, your problem comes from the fact that the streams you get
> back from popen2 are in non-blocking mode and that once an error
> occured on the read end, you need to clear its state to be able to read
> again. When you put your code into a m-file, you should
> 1) use fflush after writing something in the write-end, to be sure the data
> arrived to the child process
> 2) maybe wait a little bit before trying to read something on the read-end,
> to be sure the child process has processed the data and answered back;
> if an error occured, use fclear to clear the stream state
> 
> Alternatively, you can use an (apparently) undocumented feature of the
> popen2 function: you can provide a 3rd argument to specify the pipe mode;
> if true, the pipes are blocking, if false (the default), the pipes are
> non-blocking.
> In non-blocking mode, be aware that you may block octave if there's nothing
> to read on the read-end.
> 
> Michael.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave

Hello Michael,
thanks for pointing out. by your hints i got my things working now.
tomorrow i'll set my uptdated code on the list (now a bit short in time) 
thanks, Andreas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]