Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PGresult *result;
- PGconn *conn;
- char dane[150] = "host=localhost port=5432 dbname=";
- char pom[50];
- printf("Podaj nazwe dla bazy: ");
- scanf("%s", pom);
- strcat(dane, pom);
- strcat(dane, " user=");
- printf("Podaj nazwe uzytkownika: ");
- scanf("%s", pom);
- strcat(dane, pom);
- strcat(dane, " password=");
- printf("Podaj haslo: ");
- struct termios term, term_orig;
- tcgetattr(STDIN_FILENO, &term);
- term_orig = term;
- term.c_lflag &= ~ECHO;
- tcsetattr(STDIN_FILENO, TCSANOW, &term);
- scanf("%s", pom);
- tcsetattr(STDIN_FILENO, TCSANOW, &term_orig);
- strcat(dane, pom);
- conn = PQconnectdb(dane);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement