octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #54622] test importdata fails in dev octave wi


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54622] test importdata fails in dev octave with windows
Date: Thu, 6 Sep 2018 16:42:21 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #24, bug #54622 (project octave):

The dlmread() routine opens a file as follows:


      input_file.open (ascii_fname.c_str (), std::ios::in);


where the second argument is mode.  Now, this is a bit more complex than file
mode options that I've seen.  They are discussed here:

http://www.cplusplus.com/reference/ios/ios_base/openmode/

Notice how none of these are used directly.  Instead, the documentation gives
some kind of derived class ios_base::in, which also is not the same as
std::ios::in.  I don't know if the settings are fixed based upon the way
std::ios::in is declared, or perhaps based upon the way std::ios::in instance
was opened, or what.

>From there, it isn't too complicated.  The routine just looks at each
character to determine if the ascii makes sense in terms of complex number
format, etc. and when it determines it should read a double does:


template <typename T>
T
octave_read_value (std::istream& is)
{
  T retval;
  is >> retval;
  return retval;
}

[snip]

// The next four functions are provided for backward compatibility.
inline double
octave_read_double (std::istream& is)
{
  return octave_read_value<double> (is);
}


Of course, there can be a lot hidden in that ">>" operator depending on how
the stream is opened.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54622>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]