GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
file-io.cc File Reference
#include <cerrno>
#include <cstdio>
#include <iostream>
#include <limits>
#include <stack>
#include <string>
#include <vector>
#include "error.h"
#include "file-ops.h"
#include "file-stat.h"
#include "lo-ieee.h"
#include "mkostemp-wrapper.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "tmpfile-wrapper.h"
#include "unistd-wrappers.h"
#include "defun.h"
#include "errwarn.h"
#include "file-io.h"
#include "load-path.h"
#include "oct-fstrm.h"
#include "oct-iostrm.h"
#include "oct-map.h"
#include "oct-prcstrm.h"
#include "oct-stream.h"
#include "oct-strstrm.h"
#include "ov.h"
#include "ovl.h"
#include "pager.h"
#include "sysdep.h"
#include "utils.h"
#include "variables.h"
Include dependency graph for file-io.cc:

Go to the source code of this file.

Functions

the second is matched to the
second specifier and placed in
the second column and so forth
If there are more words than
specifiers then the process is
repeated until all words have
been processed or the limit
imposed by 
any (non-whitespace) text in the format that is not one of these specifiers is considered a literal.If there is a literal between two format specifiers then that same literal must appear in the input stream between the matching words.The following specifiers are valid
 
void cleanup_tmp_files (void)
 
void close_files (void)
 
static int do_fwrite (octave_stream &os, const octave_value &data, const octave_value &prec_arg, const octave_value &skip_arg, const octave_value &arch_arg)
 
OCTAVE_EXPORT octave_value_list Ffclose (const octave_value_list &args, int) ode
 
OCTAVE_EXPORT octave_value_list Ffwrite (const octave_value_list &args, int) returning the number of values ar
 
static std::ios::openmode fopen_mode_to_ios_mode (const std::string &mode)
 
void initialize_file_io (void)
 
void mark_for_deletion (const std::string &file)
 
static void normalize_fopen_mode (std::string &mode, bool &use_zlib)
 
nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit and then
converted to the native
representation Opening a file
that is already open simply
opens it again and returns a
separate file id It is not an
error to open a file several
though writing to the same
file through several different
file ids may produce
unexpected results The
possible values text mode
reading and writing
automatically converts
linefeeds to the appropriate
line end character for the 
system (carriage-return linefeed on Windows, carriage-return on Macintosh).The default when no mode is specified is binary mode.Additionally
 
 while (ischar(s=fgets(fid))) fputs(stdout
 

Variables

nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit and then
converted to the native
representation Opening a file
that is already open simply
opens it again and returns a
separate file id It is not an
error to open a file several
though writing to the same
file through several different
file ids may produce
unexpected results The
possible values 
amp {mode} may have are able sis tem amp{r} (default) Open a file for reading. tem amp{w} Open a file for writing. The previous contents are discarded. tem amp{a} Open or create a file for writing at the end of the file. tem amp{r+} Open an existing file for reading and writing. tem amp{w+} Open a file for reading or writing. The previous contents are discarded. tem amp{a+} Open or create a file for reading or writing at the end of the file. nd table Append a code{"t"} to the mode string to open the file in text mode or a code{"b"} to open in binary mode. On Windows and Macintosh systems
 
nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit and then
converted to the native
representation Opening a file
that is already open simply
opens it again and returns a
separate file id It is not an
error to open a file several
though writing to the same
file through several different
file ids may produce
unexpected results The
possible values text mode
reading and writing
automatically converts
linefeeds to the appropriate
line end character for the you
may append a you must also
open the file in binary mode
The parameter 
ar {arch} is a string specifying the default data format for the file. Valid values for ar{arch} are: able sis tem code{"native"} or code{"n"} (default) The format of the current machine. tem code{"ieee-be"} or code{"b"} IEEE big endian format. tem code{"ieee-le"} or code{"l"} IEEE little endian format. nd table oindent However
 
nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit and then
converted to the native
representation Opening a file
that is already open simply
opens it again and returns a
separate file id It is not an
error to open a file several
though writing to the same
file through several different
file ids may produce
unexpected results The
possible values text mode
reading and writing
automatically converts
linefeeds to the appropriate
line end character for the you
may append a 
code {"z"} to the mode string to open a gzipped file for reading or writing. For this to be successful
 
otherwise an error message is
printed The permission mask is
a UNIX concept used when
creating new objects on a file
system such as 
directories
 
it returns The second form of
the and any FIDs associated
with gnuplot 
eealso
 
otherwise an error message is
printed The permission mask is
a UNIX concept used when
creating new objects on a file
system such as 
files
 
nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit 
first
 
nd example oindent opens the file ile {splat.dat} for reading. If necessary
 
it returns The second form of the ode {fclose} call closes all open files except ode{stdin}
 
 otherwise
 
 returns
 
endwhile rint
 
 s
 
static octave_value stderr_file
 
static octave_stream stderr_stream
 
static octave_value stdin_file
 
static octave_stream stdin_stream
 
static octave_value stdout_file
 
static octave_stream stdout_stream
 
nd example oindent opens the
file binary numeric values
will be read assuming they are
stored in IEEE format with the
least significant bit and then
converted to the native
representation Opening a file
that is already open simply
opens it again and returns a
separate file id It is not an
error to open a file several 
times
 
std::stack< std::stringtmp_files
 

Function Documentation

the second is matched to the second specifier and placed in the second column and so forth If there are more words than specifiers then the process is repeated until all words have been processed or the limit imposed by any ( non-  whitespace)

Definition at line 1491 of file file-io.cc.

References string.

Referenced by jit_convert_llvm::convert_loop().

void cleanup_tmp_files ( void  )

Definition at line 125 of file file-io.cc.

References filename, octave_unlink_wrapper(), and string.

void close_files ( void  )

Definition at line 107 of file file-io.cc.

References octave_stream_list::clear().

static int do_fwrite ( octave_stream os,
const octave_value data,
const octave_value prec_arg,
const octave_value skip_arg,
const octave_value arch_arg 
)
static
OCTAVE_EXPORT octave_value_list Ffclose ( const octave_value_list args,
int   
)

Definition at line 247 of file file-io.cc.

Referenced by install_file_io_fcns().

OCTAVE_EXPORT octave_value_list Ffwrite ( const octave_value_list args,
int   
)
static std::ios::openmode fopen_mode_to_ios_mode ( const std::string mode)
static

Definition at line 199 of file file-io.cc.

References error(), retval, and octave::math::trunc().

void initialize_file_io ( void  )
void mark_for_deletion ( const std::string file)

Definition at line 119 of file file-io.cc.

static void normalize_fopen_mode ( std::string mode,
bool use_zlib 
)
static

Definition at line 136 of file file-io.cc.

References err_disabled_feature(), and warning_with_id().

nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values text mode reading and writing automatically converts linefeeds to the appropriate line end character for the system ( carriage-return linefeed on  Windows,
carriage-return on  Macintosh 
)
while ( ischar(s=fgets(fid))  )

Variable Documentation

nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and amp {mode} may have are able sis tem amp{r} (default) Open a file for reading. tem amp{w} Open a file for writing. The previous contents are discarded. tem amp{a} Open or create a file for writing at the end of the file. tem amp{r+} Open an existing file for reading and writing. tem amp{w+} Open a file for reading or writing. The previous contents are discarded. tem amp{a+} Open or create a file for reading or writing at the end of the file. nd table Append a code{"t"} to the mode string to open the file in text mode or a code{"b"} to open in binary mode. On Windows and Macintosh systems

Definition at line 608 of file file-io.cc.

successfully written to the file The argument and ar {arch} is a string specifying the default data format for the file. Valid values for ar{arch} are: able sis tem code{"native"} or code{"n"} (default) The format of the current machine. tem code{"ieee-be"} or code{"b"} IEEE big endian format. tem code{"ieee-le"} or code{"l"} IEEE little endian format. nd table oindent However

Definition at line 608 of file file-io.cc.

nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a code {"z"} to the mode string to open a gzipped file for reading or writing. For this to be successful

Definition at line 608 of file file-io.cc.

otherwise an error message is printed The permission mask is a UNIX concept used when creating new objects on a file system such as directories

Definition at line 2981 of file file-io.cc.

it returns The second form of the and any FIDs associated with gnuplot eealso

Definition at line 247 of file file-io.cc.

otherwise an error message is printed The permission mask is a UNIX concept used when creating new objects on a file system such as files
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit first

Definition at line 608 of file file-io.cc.

nd example oindent opens the file ile {splat.dat} for reading. If necessary

Definition at line 608 of file file-io.cc.

successfully written to the file The argument and and are interpreted as described for ode {fclose} call closes all open files except ode{stdin}

Definition at line 247 of file file-io.cc.

otherwise

Definition at line 247 of file file-io.cc.

returns

Definition at line 247 of file file-io.cc.

endwhile rint

Definition at line 2682 of file file-io.cc.

s

Definition at line 2682 of file file-io.cc.

Referenced by QtHandles::accelSequence(), tree_argument_list::append(), string_vector::append(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::bad(), basename(), octave::math::betaincinv(), box(), casyi(), cbknu(), Cell::Cell(), charNDArray::charNDArray(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::clear(), DiagMatrix::column(), FloatDiagMatrix::column(), ComplexDiagMatrix::column(), FloatComplexDiagMatrix::column(), compute_attribute_value(), octave_sparse_matrix::convert_to_str_internal(), octave_bool::convert_to_str_internal(), cseri(), load_path::loader::display(), bp_table::do_add_breakpoint_1(), octave::sys::env::do_base_pathname(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::do_close(), gh_manager::do_execute_callback(), do_leftdiv_dm_sm(), do_mul_sm_dm(), do_rand(), do_rightdiv_sm_dm(), octave_rand::do_seed(), radio_property::do_set(), color_property::do_set(), double_radio_property::do_set(), QConsolePrivate::drawText(), EigsComplexNonSymmetricFunc(), EigsComplexNonSymmetricMatrix(), EigsComplexNonSymmetricMatrixShift(), EigsRealNonSymmetricFunc(), EigsRealNonSymmetricMatrix(), EigsRealNonSymmetricMatrixShift(), EigsRealSymmetricFunc(), EigsRealSymmetricMatrix(), EigsRealSymmetricMatrixShift(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::eof(), octave::math::expm1(), extract_function(), F77_FUNC(), F__dump_symtab_info__(), Fcolloc(), for(), Fsqrtm(), G__osmesa_print__(), mxArray_octave_value::get_class_name(), octave_rand::get_internal_state(), Givens(), Gsymrcm(), if(), octave_kw_hash::in_word_set(), schur< T >::init(), jit_convert::initialize(), initialize_command_input(), octave_rand::initialize_mersenne_twister(), Vt102Emulation::initTokenizer(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::input_stream(), Java_org_octave_Octave_doEvalString(), QWinTerminalImpl::keyPressEvent(), link(), octave_char_matrix_str::load_hdf5(), octave::math::log1p(), octave::textscan::lookahead(), Matrix::lssolve(), FloatMatrix::lssolve(), ComplexMatrix::lssolve(), FloatComplexMatrix::lssolve(), idx_vector::maybe_reduce(), load_path::loader::move(), mx_inline_fill(), mx_inline_xsum(), null(), octregexp(), operator*(), operator*=(), operator+=(), operator-=(), operator/=(), operator<<(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::output_stream(), octave::textscan::parse_options(), plus_or_minus(), pr_any_float(), tree_print_code::print_fcn_handle_body(), octave_base_stream::puts(), octave_stream::puts(), quote_path(), rational_approx(), raw_mode(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::rdbuf(), read_binary_data(), Vt102Emulation::receiveChar(), DiagMatrix::row(), FloatDiagMatrix::row(), ComplexDiagMatrix::row(), FloatComplexDiagMatrix::row(), octave::math::rsf2csf< ComplexMatrix, Matrix >(), octave::math::rsf2csf< FloatComplexMatrix, FloatMatrix >(), octave_fcn_inline::save_hdf5(), octave_char_matrix_str::save_hdf5(), octave_cell::save_hdf5(), save_mat5_binary_element(), save_mat_binary_data(), octave::textscan::scan_complex(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::seek(), QtHandles::GLCanvas::selectFromAxes(), octave::directory_path::set(), base_property::set_name(), octave::text_renderer::string::set_string(), setcompression(), file_editor_tab::show_auto_completion(), single_match_exists(), Sparse< T >::Sparse(), octave_user_function::stash_function_name(), tree_constant::stash_original_text(), oct_data_conv::string_to_data_type(), string_array_property::string_value(), string_vector::string_vector(), octave_cell::string_vector_value(), strip_spaces(), subst_octave_home(), octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::tell(), octave::sys::time::time(), times_or_divide(), token::token(), QtHandles::Utils::toStringVector(), translateKey(), unbox(), axes::properties::update_aspectratios(), axes::properties::update_camera(), file_editor_tab::update_lexer(), octave::ft_text_renderer::visit(), octave::sys::base_tm::zone(), and octave_tstdiostream< c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile >::~octave_tstdiostream().

octave_value stderr_file
static

Definition at line 83 of file file-io.cc.

octave_stream stderr_stream
static

Definition at line 87 of file file-io.cc.

octave_value stdin_file
static

Definition at line 81 of file file-io.cc.

octave_stream stdin_stream
static

Definition at line 85 of file file-io.cc.

octave_value stdout_file
static

Definition at line 82 of file file-io.cc.

octave_stream stdout_stream
static

Definition at line 86 of file file-io.cc.

nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several times

Definition at line 608 of file file-io.cc.

Referenced by install_class_ops().

std::stack<std::string> tmp_files

Definition at line 116 of file file-io.cc.