On Fri, Mar 30, 2007 at 11:43:08AM -0400, William Gray wrote: > The solution was to not clear result until later, or to copy the data in > allocated memory, then clear the result, which we did thusly: > > tmp_str = PQgetvalue(result, 0, 0); > tmp_str_len = strlen(tmp_str); > event_id = xmalloc(tmp_str_len + 1); > strncpy(event_id, tmp_str, tmp_str_len); Glad you got your problem solved. What you've done here is so common there's even a standard function for it: strdup(). So what you did is equivalent to: event_id = strdup( PQgetvalue(result, 0, 0) ); You obviously need to free it later, but this gives you the right idea... Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature