24 #if defined (HAVE_CONFIG_H) 50 while (eol > 0 && eol > bol
60 std::deque<std::string>
63 std::deque<std::string>
retval;
80 (*current_liboctave_error_handler) (
"no such file, '%s'",
fname.c_str ());
84 std::ifstream
file (
fname.c_str (), std::ios::in | std::ios::binary);
94 (
"error reading file %s",
fname.c_str ());
105 std::deque<size_t> tmp_offsets;
107 tmp_offsets.push_back (0);
109 size_t len = buf.length ();
111 for (
size_t i = 0;
i < len;
i++)
115 if (
c ==
'\r' && ++
i < len)
120 tmp_offsets.push_back (
i+1);
122 tmp_offsets.push_back (
i);
125 tmp_offsets.push_back (
i+1);
128 tmp_offsets.push_back (len-1);
130 size_t n = tmp_offsets.size ();
132 std::vector<size_t>
retval (n);
134 for (
auto& elt : tmp_offsets)
For example cd octave end example noindent changes the current working directory to file
std::vector< size_t > m_offsets
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
static std::string snarf_file(const std::string &fname)
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 of 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 permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
static std::vector< size_t > get_line_offsets(const std::string &buf)
std::string get_line(size_t line) const
std::deque< std::string > get_lines(size_t line, size_t num_lines) const
size_t num_lines(void) const
octave::sys::file_stat fs(filename)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string