Re: Reading character variables through nc_get_var*_(text|schar|uchar)

Philippe Poilbarbe <Philippe.Poilbarbe@xxxxxx> writes:

> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
>   <title></title>
> </head>
> <body bgcolor="#cccccc" text="#000000">
> Hello,<br>
> <br>
> I am a bit confused concerning the functions
> nc_get_var*_(text|schar|uchar)<br>
> Specially for my case nc_get_vara_text, nc_get_vara_uchar,
> nc_get_vara_schar.<br>
> <br>
> I thought they were all designed to read character variables returning
> the same<br>
> values in all cases (just casting the pointers).<br>
> <br>
> But when I use nc_get_vara_uchar I have the following error:<br>
> &laquo;Attempt to convert between text &amp; numbers&raquo;<br>
> <br>
> Are the uchar/schar variants of the functions for numbers or do I<br>
> miss something?<br>
> <br>
> Thanks.<br>
> Philippe<br>
> <div class="moz-signature">-- <br>
> <table style="text-align: left; border-collapse: collapse;" border="0"
>  cellpadding="5" cellspacing="0">
>   <tbody>
>     <tr>
>       <th
>  style="vertical-align: middle; text-align: center; font-size: larger;">
> Philippe Poilbarbe </th>
>       <th
>  style="border-style: solid solid none; border-width: 2px; vertical-align: 
> middle; text-align: center; background-color: rgb(204, 204, 255); font-style: 
> italic;">
> CLS Space Oceanography Division<br>
>       </th>
>     </tr>
>     <tr>
>       <td
>  style="border-style: solid; border-width: 2px; vertical-align: middle; 
> background-color: rgb(234, 234, 255);">
> <a class="moz-txt-link-freetext" 
> href="mailto:Philippe.Poilbarbe@xxxxxx";>mailto:Philippe.Poilbarbe@xxxxxx</a><br>
>       </td>
>       <td
>  style="border-style: none solid solid; border-width: 2px; background-color: 
> rgb(204, 204, 255); vertical-align: middle; text-align: center;">
>       <br>
> Parc technologique du canal<br>
> 8-10, Rue Hermes<br>
> 31520 Ramonville St-Agne<br>
> France<br>
>       </td>
>     </tr>
>   </tbody>
> </table>
> </div>
> </body>
> </html>

Howdy!

If you define a variable as NC_CHAR you must use the *_text functions
to read and write it.

If you define a variable as NC_BYTE you may use any of the numeric
read/write functions (i.e. _uchar, _schar, _short, etc.) The number
types can all be converted to other number types.

This is all explained here if you want more information:

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Type-Conversion.html

Thanks!

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx

==============================================================================
To unsubscribe netcdfgroup, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================


  • 2007 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: