31 lines
701 B
C
31 lines
701 B
C
/*use sleep*/
|
|
#include <unistd.h>
|
|
|
|
/*use printf*/
|
|
#include <stdio.h>
|
|
|
|
int main()
|
|
{
|
|
/*declaration*/
|
|
int cx;
|
|
int port = 5432;
|
|
char * user = "begerad";
|
|
char * secret = "secret";
|
|
char * host = "localhost";
|
|
char * db = "vbn_data";
|
|
/*TODO How is const defined?*/
|
|
const int pqConInfoSize = 100;
|
|
char pqConInfo[pqConInfoSize];
|
|
|
|
printf("main() Started...\n");
|
|
cx = snprintf(pqConInfo,pqConInfoSize,"postgresql://%s:%s@%s:%d/%s",user,secret,host,port,db);
|
|
if(cx>=0 && cx<pqConInfoSize){
|
|
printf("main() pqConInfo: %s\n",pqConInfo);
|
|
printf("main() cx: %d\n",cx);
|
|
}else{
|
|
fprintf(stderr,"main() error creating pqConInfo\n");
|
|
}
|
|
printf("main() Done.\n");
|
|
return 0;
|
|
}
|