aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-03-04 23:15:16 +0000
committertradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d>2002-03-04 23:15:16 +0000
commitdde580027958318c4fc67ead84a77a433338ebcc (patch)
tree94f556fbcf17171144a0ab0289311efc61c10255
parente7f05951a00b513113dd92d3caee3ee4c4c7e477 (diff)
Check if the output file already exists - and open it in append mode then.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@107 4825ed28-b72c-4eae-9704-e50c059e567d
-rw-r--r--src/util/hdf5_merge.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util/hdf5_merge.c b/src/util/hdf5_merge.c
index 3614bc3..29139ef 100644
--- a/src/util/hdf5_merge.c
+++ b/src/util/hdf5_merge.c
@@ -121,11 +121,17 @@ int main (int argc, char *argv[])
}
}
- /* create output file */
- outfile = H5Fcreate (argv[argc-1], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* try to open an existing outfile file in append mode,
+ if this fails create it as a new file */
+ outfile = H5Fopen (argv[argc-1], H5F_ACC_RDWR, H5P_DEFAULT);
if (outfile < 0)
{
- fprintf (stderr, "ERROR: Cannot create HDF5 output file '%s' !\n\n",
+ outfile = H5Fcreate (argv[argc-1], H5F_ACC_TRUNC, H5P_DEFAULT,
+ H5P_DEFAULT);
+ }
+ if (outfile < 0)
+ {
+ fprintf (stderr, "ERROR: Cannot open HDF5 output file '%s' !\n\n",
argv[argc - 1]);
return (-1);
}