// Opens an existing HDF5 file. func OpenFile(name string, flags int) (*File, error) { c_name := C.CString(name) defer C.free(unsafe.Pointer(c_name)) // FIXME: file props hid := C.H5Fopen(c_name, C.uint(flags), P_DEFAULT.id) if err := checkID(hid); err != nil { return nil, fmt.Errorf("error opening hdf5 file: %s", err) } return newFile(hid), nil }
// Opens an existing HDF5 file. func OpenFile(name string, flags int) (*File, error) { c_name := C.CString(name) defer C.free(unsafe.Pointer(c_name)) // FIXME: file props hid := C.H5Fopen(c_name, C.uint(flags), P_DEFAULT.id) err := h5err(C.herr_t(int(hid))) if err != nil { return nil, err } return newFile(hid), nil }
// Open opens an existing file. func Open(path string) (*File, error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) fid := C.H5Fopen(cpath, C._H5F_ACC_RDWR(), C.H5P_DEFAULT) if fid < 0 { return nil, errors.New("failed to open the file") } file := &File{ fid: fid, } return file, nil }
// Opens an existing HDF5 file. // hid_t H5Fopen( const char *name, unsigned flags, hid_t fapl_id ) func OpenFile(name string, flags int) (f *File, err error) { f = nil err = nil c_name := C.CString(name) defer C.free(unsafe.Pointer(c_name)) // FIXME: file props hid := C.H5Fopen(c_name, C.uint(flags), P_DEFAULT.id) err = togo_err(C.herr_t(int(hid))) if err != nil { return } f = new_file(hid) return }