GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-prcstrm.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <cstdio>
31 
32 #include "oct-prcstrm.h"
33 #include "sysdep.h"
34 
36 
37 octave::stream
38 octave_iprocstream::create (const std::string& n, std::ios::openmode arg_md,
40  const std::string& encoding)
41 {
42  return octave::stream (new octave_iprocstream (n, arg_md, ff, encoding));
43 }
44 
46  std::ios::openmode arg_md,
48  const std::string& encoding)
49  : octave::stdiostream (n, octave::popen (n.c_str (), "r"),
50  arg_md, ff, encoding, octave::pclose)
51 { }
52 
54 {
55  do_close ();
56 }
57 
58 octave::stream
59 octave_oprocstream::create (const std::string& n, std::ios::openmode arg_md,
61  const std::string& encoding)
62 {
63  return octave::stream (new octave_oprocstream (n, arg_md, ff, encoding));
64 }
65 
67  std::ios::openmode arg_md,
69  const std::string& encoding)
70  : octave::stdiostream (n, octave::popen (n.c_str (), "w"),
71  arg_md, ff, encoding, octave::pclose)
72 { }
73 
75 {
76  do_close ();
77 }
78 
OCTAVE_END_NAMESPACE(octave)
octave_iprocstream(const std::string &n, std::ios::openmode arg_md=std::ios::in, octave::mach_info::float_format flt_fmt=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-prcstrm.cc:45
static octave::stream create(const std::string &n, std::ios::openmode arg_md=std::ios::in, octave::mach_info::float_format flt_fmt=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-prcstrm.cc:38
octave_oprocstream(const std::string &n, std::ios::openmode arg_md=std::ios::out, octave::mach_info::float_format flt_fmt=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-prcstrm.cc:66
static octave::stream create(const std::string &n, std::ios::openmode arg_md=std::ios::out, octave::mach_info::float_format flt_fmt=octave::mach_info::native_float_format(), const std::string &encoding="utf-8")
Definition: oct-prcstrm.cc:59
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
float_format
Definition: mach-info.h:38
octave_idx_type n
Definition: mx-inlines.cc:753
int pclose(FILE *f)
Definition: sysdep.cc:711
FILE * popen(const char *command, const char *mode)
Definition: sysdep.cc:695