// Creates an HDF5 file. func CreateFile(name string, flags int) (*File, error) { c_name := C.CString(name) defer C.free(unsafe.Pointer(c_name)) // FIXME: file props hid := C.H5Fcreate(c_name, C.uint(flags), P_DEFAULT.id, P_DEFAULT.id) if err := checkID(hid); err != nil { return nil, fmt.Errorf("error creating hdf5 file: %s", err) } return newFile(hid), nil }
// Creates an HDF5 file. func CreateFile(name string, flags int) (*File, error) { c_name := C.CString(name) defer C.free(unsafe.Pointer(c_name)) // FIXME: file props hid := C.H5Fcreate(c_name, C.uint(flags), P_DEFAULT.id, P_DEFAULT.id) err := h5err(C.herr_t(int(hid))) if err != nil { return nil, err } return newFile(hid), nil }
// Create creates a new file. func Create(path string) (*File, error) { cpath := C.CString(path) defer C.free(unsafe.Pointer(cpath)) fid := C.H5Fcreate(cpath, C._H5F_ACC_TRUNC(), C.H5P_DEFAULT, C.H5P_DEFAULT) if fid < 0 { return nil, errors.New("failed to create a file") } file := &File{ fid: fid, } return file, nil }
// Creates an HDF5 file. // hid_t H5Fcreate( const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id ) func CreateFile(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.H5Fcreate(c_name, C.uint(flags), P_DEFAULT.id, P_DEFAULT.id) err = togo_err(C.herr_t(int(hid))) if err != nil { return } f = new_file(hid) return }