On Tue, 24 Apr 2001, Andy Champion wrote:
> Hi, i'm trying to insert data pulled into a postgresql database but i'm
> having some problems with the inserts.
>
> i know that this:
> sprintf(insert_string, "INSERT INTO udpdata VALUES (1234);\n");
>
> is a valid statment, but how do i alter this so that instead of the 1234
> i insert the value of a variable?
int value = 1234;
sprintf(insert_string, "INSERT INTO udpdata VALUES(%d);\n", value);
Check the man page or the documentation for your C run-time libraries for
the sprintf-like functions (printf, sprintf, fprintf, etc) for information
on formatting rules.
-- Brett http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
They are relatively good but absolutely terrible. -- Alan Kay, commenting on Apollos