I tried to use atol but i get always 0 as result. Is this because I use a
binary cursor to select the data (there are some PostGIS datatypes inside my
resultset which are binary data).
Best regards,
Johan de Koning
-----Oorspronkelijk bericht-----
Van: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Verzonden: donderdag 11 augustus 2005 15:57
Aan: jtv@xs4all.nl
CC: Johan C. de Koning; pgsql-interfaces@postgresql.org
Onderwerp: Re: [INTERFACES] Getting oid with libpq
jtv@xs4all.nl writes:
> const char *OldLocale = setlocale(LC_NUMERIC, "C");
> Then run the pointer returned by PQgetValue() through atol() to get a
> numeric value, and finally restore the previous locale with
> setlocale(LC_NUMERIC, OldLocale);
Uh ... there is nothing at all locale-sensitive about atol, nor strtoul
which is what you really want to use for an OID.
regards, tom lane