octave-maintainers
[Top][All Lists]
Advanced

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

RE: MSVC compiler support [patch 28]: setvbuf crash


From: michael . goffioul
Subject: RE: MSVC compiler support [patch 28]: setvbuf crash
Date: Thu, 26 Oct 2006 15:54:44 +0200

This seems to work.
 
Michael.





On 17-Oct-2006, Michael Goffioul wrote:| setvbuf leads to a crash when called on a pipe (don't know why).| | Index: src/oct-procbuf.cc| ===================================================================| RCS file: /cvs/octave/src/oct-procbuf.cc,v| retrieving revision 1.30| diff -p -c -r1.30 oct-procbuf.cc| *** src/oct-procbuf.cc 8 May 2006 20:23:05 -0000 1.30| --- src/oct-procbuf.cc 17 Oct 2006 11:07:42 -0000| *************** octave_procbuf::open (const char *comman| *** 78,85 ****| --- 78,87 ----| | open_p = true;| | + #ifndef _MSC_VER| if (mode & std::ios::out)| ::setvbuf (f, 0, _IOLBF, 0);| + #endif| | return this;Perhaps this is crashing because size (the final argument) is 0. Canyou try using something like 1024 and see if that works? Myunderstanding was that if the buffer pointer was 0, the buffer wouldbe automatically allocated, and at some point I must have thought thatthe buffer would also be appropriately sized if the SIZE argument is0. But the MSDN man page s! ays The array pointed to by buffer is used as the buffer, unless it is NULL, in which case setvbuf uses an automatically allocated buffer of length size/2 * 2 bytes.so I guess we need to set size to a nonzero value. I think POSIXspecifies BUFSIZE as an approprite size, so I changed this code to use :setvbuf (f, 0, _IOLBF, BUFSIZ);and I'm defining BUFSIZ at the top of the file this way: #ifndef BUFSIZ #define BUFSIZ 1024 #endifThanks,jwe



reply via email to

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