hdf5 -readonly <handle> <filename>
It is the main command of this package. It Open an existent or new HDF5 filename.
Handle is an arbitrary name and becomes a new Tcl command that represents the file and that can be used to write or read from the file.
If filename does not exist, it is created. If it exists and it is already a hdf5 file, it is opened. If not, an error is raised.
If the flag -readonly is provided, then the file is opened with read only access
Example
Code Block |
---|
#auxiliary proc to get an arbitrary name of an non-existent Tcl command or proc, hdf5 will create a new command with this name
proc GetAutomaticHdf5CommandName { } {
set name ""
for {set i 0} {$i<10000} {incr i} {
set fullname hdf${i}
if { [info commands $fullname]=="" && [info procs $fullname]=="" } {
set name $fullname
break
}
}
return $name
}
package require hdf5
set h [GetAutomaticHdf5CommandName]
hdf5 $h {C:\temp\test_read.h5} |
Example of proc to provide a valid unused command name