(Please ignore portability issues, as this is just for fun)
Code:
std::string InputUI(std::string msg="Input",int numchars=50)
{
std::string command = "kdialog --inputbox \"" + msg + "\"";
auto f = popen(command.c_str(),"r");
char* ret = new char[numchars];
fgets(ret,numchars,f);
ret[numchars-1]='\0';
std::string ret_str = std::string(ret);
delete [] ret;
return ret_str;
}
But If I call this function twice in a row...and cout the strings returned, they seem to output after the second one is returned, even when I use endl in between.
Other than that, this seems to work fine for me, but have I missed something obvious?