octave-maintainers
[Top][All Lists]
Advanced

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

Re: "save" to and "load" from file descriptor


From: John W. Eaton
Subject: Re: "save" to and "load" from file descriptor
Date: Thu, 14 Jun 2007 13:20:59 -0400

On 14-Jun-2007, Michael Goffioul wrote:

| On 6/14/07, Aaron Birenboim <address@hidden> wrote:
| > > | work. I cannot enforce binary mode since pipes have only
| > > "w" or "r".)
| > >
| > > I think pipes are by definition binary.
| >
| > At least 4-5 years ago they were TEXT ONLY on Win32.
| > I had to re-write some code to deal with that on a port from LINUX.
| > Perhaps CygWin will allow binary...
| 
| Pipe mode can be text or binary. But it is usually text mode by default.
| Win32 "popen" allows to specify "b" or "t" modifier along with "r"/"w".
| Maybe this could be added to the octave front-end for popen?

Does Cygwin also accept "rb" and "wb"?  If not, then we need an ifdef
around the following change.

jwe

src/ChangeLog:

2007-06-14  John W. Eaton  <address@hidden>

        * oct-procbuf.cc (procbuf::open): Open pipe in binary mode for
        Windows.


Index: src/oct-procbuf.cc
===================================================================
RCS file: /cvs/octave/src/oct-procbuf.cc,v
retrieving revision 1.33
diff -u -u -r1.33 oct-procbuf.cc
--- src/oct-procbuf.cc  26 Oct 2006 14:51:37 -0000      1.33
+++ src/oct-procbuf.cc  14 Jun 2007 17:20:30 -0000
@@ -74,7 +74,7 @@
   if (is_open ()) 
     return 0;
 
-  f = ::W32POPEN (command, (mode & std::ios::in) ? "r" : "w");
+  f = ::W32POPEN (command, (mode & std::ios::in) ? "rb" : "wb");
 
   if (! f)
     return 0;

reply via email to

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