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 |
|
31 octave_iprocstream::octave_iprocstream (const string& n, |
|
32 ios::openmode arg_md, |
2317
|
33 oct_mach_info::float_format flt_fmt) |
|
34 : octave_istdiostream (n, 0, arg_md, flt_fmt) |
2081
|
35 { |
|
36 fp = popen (n.c_str (), "r"); |
|
37 |
|
38 if (fp) |
|
39 { |
|
40 delete is; |
|
41 is = new istdiostream (fp); |
|
42 } |
|
43 } |
|
44 |
|
45 octave_iprocstream::~octave_iprocstream (void) |
|
46 { |
|
47 if (fp) |
|
48 { |
|
49 pclose (fp); |
|
50 fp = 0; |
|
51 } |
|
52 } |
|
53 |
|
54 octave_oprocstream::octave_oprocstream (const string& n, |
|
55 ios::openmode arg_md, |
2317
|
56 oct_mach_info::float_format flt_fmt) |
|
57 : octave_ostdiostream (n, 0, arg_md, flt_fmt) |
2081
|
58 { |
|
59 fp = popen (n.c_str (), "w"); |
|
60 |
|
61 if (fp) |
|
62 { |
|
63 delete os; |
|
64 os = new ostdiostream (fp); |
|
65 } |
|
66 } |
|
67 |
|
68 octave_oprocstream::~octave_oprocstream (void) |
|
69 { |
|
70 if (fp) |
|
71 { |
|
72 pclose (fp); |
|
73 fp = 0; |
|
74 } |
|
75 } |
|
76 |
|
77 /* |
|
78 ;;; Local Variables: *** |
|
79 ;;; mode: C++ *** |
|
80 ;;; End: *** |
|
81 */ |