Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. char *dbname = valueOfParam("dbname");
  2. char *dbuser = valueOfParam("dbuser");
  3. char *dbpass = valueOfParam("dbpass");
  4. char *conninfo;
  5. // Then I try compile new variable like this:
  6. printf("PQconnectdb("dbname=%s host=localhost user=%s password=%s");", dbname, dbuser, dbpass);
  7. // But I need create the variable
  8. sprintf(conninfo, "PQconnectdb("dbname=%s host=localhost user=%s password=%s");", dbname, dbuser, dbpass);
  9.  
  10. int len = snprintf(NULL,0,......);
  11. char * buf = malloc(len+1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement