diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-04-30 22:37:06 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-04-30 22:37:06 (GMT) |
commit | a306b38d670cbc0f040debccf55209fe0739243e (patch) | |
tree | 6c392637116dca68fc2cd6e5f50b6961308df832 /tools/h5dump/h5dumpgentest.c | |
parent | 60754030c75ad737d5b09af1cdfba4b4e153effd (diff) | |
download | hdf5-a306b38d670cbc0f040debccf55209fe0739243e.zip hdf5-a306b38d670cbc0f040debccf55209fe0739243e.tar.gz hdf5-a306b38d670cbc0f040debccf55209fe0739243e.tar.bz2 |
[svn-r6785] Purpose:
Feature Add
Description:
It's now possible to print out characters as actual characters
instead of their decimal equivalent numbers. It's the same thing that
h5ls does. The flag to do this is "--string" or "-r".
Platforms tested:
Verbena (Fortran & C++)
Arabica (Fortran)
Modi4 (Fortran & Parallel)
Misc. update:
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index d220b8b..496a0f6 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -64,6 +64,7 @@ #define FILE36 "tmulti" #define FILE37 "tlarge_objname.h5" #define FILE38 "tvlstr.h5" +#define FILE39 "tchar.h5" #define LENSTR 50 #define LENSTR2 11 @@ -2891,6 +2892,38 @@ static void gent_vlstr(void) H5Fclose(fid1); } +static void gent_char(void) +{ + const char *wdata = + "Four score and seven years ago our forefathers brought " + "forth on this continent a new nation, conceived in " + "liberty and dedicated to the proposition that all " + "men are created equal. Now we are engaged in a great " + "civil war, testing whether that nation or any nation " + "so conceived and so dedicated can long endure."; + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hsize_t dims1[1]; + + dims1[0] = strlen(wdata); + + /* Create file */ + fid1 = H5Fcreate(FILE39, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + sid1 = H5Screate_simple(1, dims1, NULL); + + /* Create a dataset */ + dataset = H5Dcreate(fid1, "Dataset1", H5T_NATIVE_CHAR, sid1, H5P_DEFAULT); + + /* Write some characters to it. */ + H5Dwrite(dataset, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + + /* Close */ + H5Dclose(dataset); + H5Sclose(sid1); + H5Fclose(fid1); +} + int main(void) { gent_group(); @@ -2942,6 +2975,7 @@ int main(void) gent_large_objname(); gent_vlstr(); + gent_char(); return 0; } |