<aname="l00030"></a>00030 <spanclass="keywordtype">size_t</span> len = <spanclass="keyword">sizeof</span>(string_value)/<spanclass="keyword">sizeof</span>(<spanclass="keywordtype">char</span>);
<aname="l00052"></a>00052 <spanclass="comment">/* create a new handle from a message in a file */</span>
<aname="l00053"></a>00053 h = <aname="a1"></a><aclass="code"href="group__grib__handle.html#g5e24f8499aa7e4178ccc25a5de3145c5"title="Create a handle from a file resource.">grib_handle_new_from_file</a>(0,in,&err);
<aname="l00055"></a>00055 printf(<spanclass="stringliteral">"Error: unable to create handle from file %s\n"</span>,infile);
<aname="l00056"></a>00056 }
<aname="l00057"></a>00057
<aname="l00058"></a>00058 <spanclass="comment">/* set centre as a long */</span>
<aname="l00059"></a>00059 GRIB_CHECK(<aname="a2"></a><aclass="code"href="group__get__set.html#g94c33cfe90c3aa887fb8e14f0bd87fe2"title="Set a long value from a key.">grib_set_long</a>(h,<spanclass="stringliteral">"centre"</span>,centre),0);
<aname="l00060"></a>00060
<aname="l00061"></a>00061 <spanclass="comment">/* get centre as a long */</span>
<aname="l00062"></a>00062 GRIB_CHECK(<aname="a3"></a><aclass="code"href="group__get__set.html#g03cfa6762312face1a3cc3ef23e16526"title="Get a long value from a key, if several keys of the same name are present, the last...">grib_get_long</a>(h,<spanclass="stringliteral">"centre"</span>,&long_value),0);
<aname="l00063"></a>00063 printf(<spanclass="stringliteral">"centre long value=%ld\n"</span>,long_value);
<aname="l00064"></a>00064
<aname="l00065"></a>00065 <spanclass="comment">/* get centre as a string */</span>
<aname="l00066"></a>00066 GRIB_CHECK(<aname="a4"></a><aclass="code"href="group__get__set.html#g8aeaf9f930eea1cc0f15e92f18a25053"title="Get a string value from a key, if several keys of the same name are present, the...">grib_get_string</a>(h,<spanclass="stringliteral">"centre"</span>,string_value,&len),0);
<aname="l00069"></a>00069 <spanclass="comment">/* get the coded message in a buffer */</span>
<aname="l00070"></a>00070 GRIB_CHECK(<aname="a5"></a><aclass="code"href="group__handling__coded__messages.html#g9d654bd4fc5f422c161edd0a140ea185"title="getting the message attached to a handle">grib_get_message</a>(h,&buffer,&size),0);
<aname="l00071"></a>00071
<aname="l00072"></a>00072 <spanclass="comment">/* write the buffer in a file*/</span>
<aname="l00080"></a>00080 <aname="a6"></a><aclass="code"href="group__grib__handle.html#g0e4b2585f22247c49b930c1579257677"title="Frees a handle, also frees the message if it is not a user message.">grib_handle_delete</a>(h);