2081
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2081
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #ifdef HAVE_CONFIG_H |
|
24 #include <config.h> |
|
25 #endif |
|
26 |
|
27 #include <cstdio> |
|
28 |
|
29 #include "oct-prcstrm.h" |
|
30 |
3951
|
31 static int |
|
32 cxx_pclose (FILE *f) |
|
33 { |
|
34 return ::pclose (f); |
|
35 } |
|
36 |
3340
|
37 octave_stream |
3544
|
38 octave_iprocstream::create (const std::string& n, std::ios::openmode arg_md, |
4587
|
39 oct_mach_info::float_format ff) |
3340
|
40 { |
4587
|
41 return octave_stream (new octave_iprocstream (n, arg_md, ff)); |
3340
|
42 } |
|
43 |
3523
|
44 octave_iprocstream::octave_iprocstream (const std::string& n, |
3544
|
45 std::ios::openmode arg_md, |
4587
|
46 oct_mach_info::float_format ff) |
4327
|
47 : octave_stdiostream (n, ::popen (n.c_str (), "r"), |
4587
|
48 arg_md, ff, cxx_pclose) |
2081
|
49 { |
|
50 } |
|
51 |
|
52 octave_iprocstream::~octave_iprocstream (void) |
|
53 { |
3652
|
54 do_close (); |
|
55 } |
|
56 |
3340
|
57 octave_stream |
3544
|
58 octave_oprocstream::create (const std::string& n, std::ios::openmode arg_md, |
4587
|
59 oct_mach_info::float_format ff) |
3340
|
60 { |
4587
|
61 return octave_stream (new octave_oprocstream (n, arg_md, ff)); |
3340
|
62 } |
|
63 |
3523
|
64 octave_oprocstream::octave_oprocstream (const std::string& n, |
3544
|
65 std::ios::openmode arg_md, |
4587
|
66 oct_mach_info::float_format ff) |
4327
|
67 : octave_stdiostream (n, ::popen (n.c_str (), "w"), |
4587
|
68 arg_md, ff, cxx_pclose) |
2081
|
69 { |
|
70 } |
|
71 |
|
72 octave_oprocstream::~octave_oprocstream (void) |
|
73 { |
3652
|
74 do_close (); |
|
75 } |
|
76 |
2081
|
77 /* |
|
78 ;;; Local Variables: *** |
|
79 ;;; mode: C++ *** |
|
80 ;;; End: *** |
|
81 */ |