Following code works
QProcess *p = new QProcess();
p->write("10 cats\n");
Now I need to send int
variable to write
command.
Something like:
QProcess *p = new QProcess();
int i = 10;
p->write(i << " cats\n");
Following code works
QProcess *p = new QProcess();
p->write("10 cats\n");
Now I need to send int
variable to write
command.
Something like:
QProcess *p = new QProcess();
int i = 10;
p->write(i << " cats\n");
Looks like you want to append variables to then pass them as parameter.
try something like this
int i{10};
QString formattedString{QString("%1 cats\n").arg(i)};
QProcess* p = new QProcess();
p->write(formattedString.toStdString().c_str());