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

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

[Octave-bug-tracker] [bug #45318] Unable to save HDF5 file using C++ API


From: Dmitry Messerman
Subject: [Octave-bug-tracker] [bug #45318] Unable to save HDF5 file using C++ API
Date: Sun, 14 Jun 2015 06:28:04 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0

URL:
  <http://savannah.gnu.org/bugs/?45318>

                 Summary: Unable to save HDF5 file using C++ API
                 Project: GNU Octave
            Submitted by: mdmitry
            Submitted on: Sun 14 Jun 2015 09:28:02 AM IDT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Crash
                  Status: None
             Assigned to: None
         Originator Name: Dmitry Messerman
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Hi,

The following code fails at runtime:
#include <fstream>
#include <string>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/toplev.h>
#include <octave/load-save.h>
#include <octave/parse.h>

using namespace std;

typedef symbol_table::symbol_record OctaveSymbolRecord;
 
int main (int argc, char** argv)
{

    auto A = ComplexNDArray(dim_vector(10,20));
    OctaveSymbolRecord a_record = OctaveSymbolRecord(0, string("A"),
octave_value(A));

    ofstream ofs;
    ofs.open("a.octave_bin",ofstream::out);
    if( !ofs.good() ) {
        cerr << "ERROR: failed to open " << argv[2] << " for writing" <<
endl;
        return 1;
    }
    //load_save_format fmt = load_save_format(LS_BINARY);
    load_save_format fmt = load_save_format(LS_HDF5);
    write_header(ofs, fmt);
    do_save(ofs, a_record, fmt, false); 
    ofs.close();

    return 0;
}

Error message is:
terminate called after throwing an instance of 'std::bad_cast'
  what():  std::bad_cast

My assumption is that problem is with HDF5 format support, as after changing
format to LS_BINARY crash goes away.

Please, advise.

Thanks,
  Dmitry




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45318>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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