diff --git a/examples/C/grib_multi_write.c b/examples/C/grib_multi_write.c index b68df1517..d0f275c58 100644 --- a/examples/C/grib_multi_write.c +++ b/examples/C/grib_multi_write.c @@ -72,7 +72,7 @@ int main(int argc, char** argv) } /* open output file */ - of = fopen(ofilename, "w"); + of = fopen(ofilename, "wb"); if (!of) { fprintf(stderr, "ERROR: unable to open output file %s\n", ofilename); exit(1); diff --git a/examples/C/grib_multi_write.sh b/examples/C/grib_multi_write.sh index a6a621a59..73942c663 100755 --- a/examples/C/grib_multi_write.sh +++ b/examples/C/grib_multi_write.sh @@ -9,20 +9,20 @@ . ./include.ctest.sh -#if [ ! -f "${data_dir}/sample.grib2" ] -#then -# echo SKIP: $0 -# exit -#fi +label="grib_multi_write_c" +tempGrib=temp.$label.grib +tempText=temp.$label.txt -${examples_dir}/c_grib_multi_write ${data_dir}/sample.grib2 ${data_dir}/multi_sample.grib2 > /dev/null +${examples_dir}/c_grib_multi_write ${data_dir}/sample.grib2 $tempGrib > /dev/null -${tools_dir}/grib_get -p step ${data_dir}/multi_sample.grib2 > ${data_dir}/multi_step.test +${tools_dir}/grib_get -p step $tempGrib > $tempText -diff ${data_dir}/multi_step.test ${data_dir}/multi_step.txt - -step=`${tools_dir}/grib_get -M -p step ${data_dir}/multi_sample.grib2` +reference=${data_dir}/multi_step.txt +diff $reference $tempText +# -M = Turn multi-field support off +step=`${tools_dir}/grib_get -M -p step $tempGrib` [ $step -eq 12 ] -rm -f ${data_dir}/multi_sample.grib2 ${data_dir}/multi_step.test +# Clean up +rm -f $tempGrib $tempText