#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "libpq-fe.h"


int main()
{
	PGconn *p = NULL;
	const char* keywords[] = { "host", "dbname", "user", "password", NULL };
	const char* values[] = { "localhost", "AAA", "gen", "GEN", NULL };

	p = PQconnectdbParams(keywords, values, 0);

	if (p == NULL) {
		printf("COULD NOT ALLOCATE MEMORY\n");
		exit(1);
	}
	else if (PQstatus(p) == CONNECTION_BAD) {
		printf("COULD NOT CONNECT\n");
		PQfinish(p);
		p = NULL;
	}


	return 0;
}
