summaryrefslogtreecommitdiffstats
path: root/hl/examples/ex_table_05.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-05 21:15:57 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-05 21:15:57 (GMT)
commit51875fc8881cdfa0c939fba82b7a00012a2c611e (patch)
tree1ae643e19692541d5e53070a522cc19d1a60784a /hl/examples/ex_table_05.c
parenta82e85c2d408386b14859f40c572a3911aaaa682 (diff)
downloadhdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.zip
hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.gz
hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.bz2
[svn-r13239]
bug fix on H5TBwrite_fields_index and name functions, the space on the H5Dwrite call was all selected
Diffstat (limited to 'hl/examples/ex_table_05.c')
-rw-r--r--hl/examples/ex_table_05.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/hl/examples/ex_table_05.c b/hl/examples/ex_table_05.c
index b39ef1d..e962d0a 100644
--- a/hl/examples/ex_table_05.c
+++ b/hl/examples/ex_table_05.c
@@ -25,9 +25,12 @@
*-------------------------------------------------------------------------
*/
-#define NFIELDS (hsize_t) 5
-#define NRECORDS (hsize_t) 8
-#define TABLE_NAME "table"
+#define NFIELDS (hsize_t) 5
+#define NRECORDS (hsize_t) 8
+#define NRECORDS_ADD (hsize_t) 3
+#define TABLE_NAME "table"
+
+
int main( void )
{
@@ -91,21 +94,15 @@ int main( void )
int i;
/* Define new values for the field "Pressure" */
- float pressure_in [NRECORDS] =
- { 0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f };
-
+ float pressure_in [NRECORDS_ADD] =
+ { 0.0f,1.0f,2.0f};
int field_index_pre[1] = { 3 };
int field_index_pos[2] = { 1,2 };
/* Define new values for the fields "Latitude,Longitude" */
- Position position_in[NRECORDS] = { {0,0},
+ Position position_in[NRECORDS_ADD] = { {0,0},
{10,10},
- {20,20},
- {30,30},
- {40,40},
- {50,50},
- {60,60},
- {70,70} };
+ {20,20} };
size_t field_sizes_pos[2]=
{
@@ -138,17 +135,19 @@ int main( void )
/* Write the pressure field starting at record 2 */
nfields = 1;
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pre, start, nrecords,
sizeof( float ), 0, field_sizes_pre, pressure_in );
+
/* Write the new longitude and latitude information starting at record 2 */
nfields = 2;
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
status=H5TBwrite_fields_index( file_id, TABLE_NAME, nfields, field_index_pos, start, nrecords,
sizeof( Position ), field_offset_pos, field_sizes_pos, position_in );
+
/* read the table */
status=H5TBread_table( file_id, TABLE_NAME, dst_size, dst_offset, dst_sizes, dst_buf );
@@ -163,6 +162,7 @@ int main( void )
printf ("\n");
}
+
/* Close the file. */
H5Fclose( file_id );