From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Joey Morris *EXTERN*" <rjmorris12(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: connecting using libpq breaks printf |
Date: | 2009-02-20 07:58:45 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C20313E823@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joey Morris wrote:
> This is my first attempt at using libpq, and I'm running across a strange
> problem. Here is my bare-bones program:
>
> #include <stdio.h>
> #include "libpq-fe.h"
>
> int main(int argc, char **argv) {
> PGconn *conn;
> fprintf(stderr, "connecting\n");
> conn = PQconnectdb("dbname=postgres");
> PQfinish(conn);
> return 0;
> }
>
> I expected this program to print "connecting", but in fact I get no output
> whatsoever. If I comment out the PQconnectdb and PQfinish lines, I see
> "connecting" as expected. What could be going on here?
I tried your program, and it compiles and runs on my MinGW installation
and also writes the output to stderr.
One silly question first: are you sure that you actually call your
executable? You didn't name it "test.exe", did you?
If you have problems printing to stderr, you could write to a log file:
outf = fopen("logfile.txt", "a"); fprintf(outf, "whatever"); fclose(outf);
or something like that.
If that doesn't work, odds are good that your code is not executed at all.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco | 2009-02-20 08:02:27 | Re: xpath functions |
Previous Message | Mike Christensen | 2009-02-20 07:30:49 | Re: Question about functions that return a set of records |