PDA

View Full Version : Command Prompt command through Qt Application



antweb
19th November 2014, 12:41
I have a command in command prompt which works the following way.


C:\Program Files\Speex>speexenc M_01E.wav new.spx

With this command I am successfully able to perform a file conversion.

How can I implement this command through Qt?
I read that it can be done through QProcess but i am not able to perform it.
I am doing this right now.


QProcess proc;
proc.start("/C:/Program Files/Speex/speexenc M_01E.wav new.spx");

But it's not working.
What am I missing out?

Please Help.

Lesiok
19th November 2014, 13:44
First slash (before C:) is a mistype or You have it in real code ?

anda_skoa
19th November 2014, 19:00
And you need to pass the arguments as a list. second argument of start().

Cheers,
_

antweb
20th November 2014, 05:50
Hello Sir,

I tried the suggestions you gave along with some further research online. Now I'm just trying to open the wav file first and I have done this.
I found this on one of the forums on Stackoverflow. But even that is not working.
Here is my code:

QProcess proc;
QString command = "C:\\windows\\system32\\cmd.exe";
QStringList arguments =
QStringList() << "/c" << "C:\\Program Files\\Speex\\M_01E.wav";
proc.start(command, arguments);

What am i missing out now Sir?

myta212
20th November 2014, 07:03
Hi,
Please try this :


QProcess proc;
QString command = "C:\\windows\\system32\\cmd.exe";
QStringList arguments =
QStringList() << "/c" << "C:\\Program Files\\Speex\\speexenc M_01E.wav new.spx";
proc.start(command, arguments);


Best regards,

myta

antweb
20th November 2014, 07:54
Still not working.

anda_skoa
21st November 2014, 07:23
Do you get any errors?
What is the return code?

Cheers,
_