List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 16 2000 4:01am
Subject:Re: Copying numeric fields with the C API
View as plain text  
At 9:44 AM -0500 04/15/2000, Gary Mills wrote:
>I'm looking for a portable way to copy a numeric field value into a
>variable, using the C API.  Using the notation in the reference
>manual, row[i] is a pointer to the value, and lengths[i] is the
>length of the value.  I assume the value is in native byte-order,
>but may not be word-aligned.  Is this correct?  I can't predict the

No, it's not correct.  The row[i] is the string representation of
the numeric value.  It will be null-terminated, so you can use
atoi(), atof(), strtol(), etc. as appropriate for your purposes.

>length in advance - it may be a calculated field, for example.
>I also can't predict the length of the C variable into which I wish
>to copy the value - it will be different on different platforms.

-- 
Paul DuBois, paul@stripped
Thread
Copying numeric fields with the C APIGary Mills15 Apr
  • Re: Copying numeric fields with the C APIsinisa15 Apr
  • Re: Copying numeric fields with the C APIPaul DuBois16 Apr
Re: Copying numeric fields with the C APIGary Mills15 Apr
  • Re: Copying numeric fields with the C APIsinisa15 Apr