X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF15F52EBB for ; Thu, 11 Aug 2005 04:06:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72625-06 for ; Thu, 11 Aug 2005 07:06:40 +0000 (GMT) Received: from smtp-vbr5.xs4all.nl (smtp-vbr5.xs4all.nl [194.109.24.25]) by svr1.postgresql.org (Postfix) with ESMTP id 61EEE52EB5 for ; Thu, 11 Aug 2005 04:06:39 -0300 (ADT) Received: from webmail.xs4all.nl (webmail12.xs4all.nl [194.109.22.172]) by smtp-vbr5.xs4all.nl (8.13.3/8.13.3) with ESMTP id j7B76brT015956; Thu, 11 Aug 2005 09:06:37 +0200 (CEST) (envelope-from jtv@xs4all.nl) Received: from 202.47.227.25 by webmail.xs4all.nl with HTTP; Thu, 11 Aug 2005 09:06:37 +0200 (CEST) Message-ID: <8327.202.47.227.25.1123743997.squirrel@202.47.227.25> In-Reply-To: <200508101213.j7ACD9lb077874@mxdrop11.xs4all.nl> References: <10445.202.47.227.25.1123671132.squirrel@202.47.227.25> <200508101213.j7ACD9lb077874@mxdrop11.xs4all.nl> Date: Thu, 11 Aug 2005 09:06:37 +0200 (CEST) Subject: Re: Getting oid with libpq From: jtv@xs4all.nl To: "Johan C. de Koning" Cc: jtv@xs4all.nl, pgsql-interfaces@postgresql.org User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.228 tagged_above=0 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05, NO_REAL_NAME=0.178] X-Spam-Level: X-Archive-Number: 200508/19 X-Sequence-Number: 5690 Johan C. de Koning wrote: > I am not an expert in C/C++ so do you know maybe where I can find some > example code or documentation about the parsing process with sscanf? In C, you'd probably want to use 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); If you're using C++, best thing to do may be to use libpqxx instead of libpq. It has functions to do the conversions for you, and takes care of locale and overflow issues as well. Jeroen