diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-06-18 20:43:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-06-18 20:43:39 (GMT) |
commit | ed1e28ac6aad572b7ba4e87e5dd0c5c4c01ee28d (patch) | |
tree | ba6c957096c8fd2bafabeed7d3217c14d802d43c /test | |
parent | f15b2278d6e94e1dc7f2bdad75d3d33906cdb7d2 (diff) | |
download | hdf5-ed1e28ac6aad572b7ba4e87e5dd0c5c4c01ee28d.zip hdf5-ed1e28ac6aad572b7ba4e87e5dd0c5c4c01ee28d.tar.gz hdf5-ed1e28ac6aad572b7ba4e87e5dd0c5c4c01ee28d.tar.bz2 |
[svn-r7055] Purpose:
Refactored code
Description:
Moved duplicated "get_file_size()" function from a couple of tests into a
central location.
Platforms tested:
FreeBSD 4.8 (sleipnir)
h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.c | 29 | ||||
-rw-r--r-- | test/h5test.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/h5test.c b/test/h5test.c index a694582..1326208 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -747,3 +747,32 @@ h5_dump_info_object(MPI_Info info) } } #endif /* H5_HAVE_PARALLEL */ + + +/*------------------------------------------------------------------------- + * Function: h5_get_file_size + * + * Purpose: Get the current size of a file (in bytes) + * + * Return: Success: Size of file in bytes (could be 0) + * Failure: 0 + * + * Programmer: Quincey Koziol + * Saturday, March 22, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +off_t +h5_get_file_size(const char *filename) +{ + h5_stat_t sb; + + /* Get the file's statistics */ + if (HDstat(filename, &sb)>=0) + return(sb.st_size); + + return(0); +} /* end get_file_size() */ + diff --git a/test/h5test.h b/test/h5test.h index ce56a59..2cdf217 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -79,6 +79,7 @@ H5TEST_DLL void h5_show_hostname(void); int h5_set_info_object(void); void h5_dump_info_object(MPI_Info info); #endif +H5TEST_DLL off_t h5_get_file_size(const char *filename); #ifdef __cplusplus } |