SHARE
TWEET

Untitled

a guest Mar 20th, 2017 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     char logData[150]="host=localhost port=5432 dbname=";
  2.     char password[50]={'\0'};
  3.     char dbname[50]={'\0'};
  4.     char user[50]={'\0'};
  5.     printf("DBname: ");
  6.     scanf("%s",&dbname);
  7.     strcat(logData,dbname);
  8.     char createdb[30]={'\0'};
  9.     strcat(createdb,"createdb ");
  10.     strcat(createdb,dbname);
  11.     strcat(createdb," 2>/dev/null");
  12.     system(createdb);
  13.     printf("User: ");
  14.     scanf("%s",&user);
  15.     strcat(logData," user=");
  16.     strcat(logData,user);
  17.     printf("Password: ");
  18.     system("stty -echo");
  19.     scanf("%s",&password);
  20.     system("stty echo");
  21.     strcat(logData," password=");
  22.     strcat(logData,password);
  23. //-----------------------------------------
  24.    
  25.   PGconn *conn = PQconnectdb(logData);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top