This is because% com_and_company is used by the system to separate two commands on the same line, it is a "special" character, such as pipe ( &
) and parses ( |
and (
), and all can be escaped with )
However if you are using Qt, it already has functions ready for it, which prevents you having to have this job of escaping the characters, for example:
Using ^
Using QProcess with QStringList you can pass the arguments and the "Qt" itself will escape them to you:
retorno = "http://localhost:5000/robo/?Nome="+nome+"&Capital="+capital;
QProcess process;
process.start("start", QStringList() << retorno);
What you probably should already solve, however it is interesting to note that Qt itself has a class called QProcess
It already has the goal of interacting with OS functions, ie if you ported your program to Linux or OSX you will not need to change anything in this part (it will depend on what else you did), example with QDesktopServices
(% is required):
retorno = "http://localhost:5000/robo/?Nome="+nome+"&Capital="+capital;
QDesktopServices::openUrl(QUrl(retorno));
So, it will fetch the system program that is associated with the URL protocol, in the case HTTP will probably open the default browser and also will not need escapes (like openUrl
). >