I am trying to create a connection to a postgres database from C++ and ask for the password from the user. Here is the code in question:
char* pass;
cout << "Please enter password for user: Mickey" << endl;
cin >> pass;
const char *connectInfo = "host=cs-linux dbname=gbianchet user=mickey password=" + pass;
I am wondering how I can get the user's input and append it to the end of the the initialization for connectInfo.
I have searched for the answer to this question and have found these links, Initialize const char* by concatenating another char* and How to cleanly use: const char* and std::string?, but they don't quite answer my question.
Any help would be much appreciated.
Thanks