Results 1 to 7 of 7

Thread: Command Prompt command through Qt Application

  1. #1
    Join Date
    Jul 2014
    Posts
    46
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Command Prompt command through Qt Application

    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.

    Qt Code:
    1. QProcess proc;
    2. proc.start("/C:/Program Files/Speex/speexenc M_01E.wav new.spx");
    To copy to clipboard, switch view to plain text mode 

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

    Please Help.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Command Prompt command through Qt Application

    First slash (before C is a mistype or You have it in real code ?

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Command Prompt command through Qt Application

    And you need to pass the arguments as a list. second argument of start().

    Cheers,
    _

  4. #4
    Join Date
    Jul 2014
    Posts
    46
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Command Prompt command through Qt Application

    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:
    Qt Code:
    1. QProcess proc;
    2. QString command = "C:\\windows\\system32\\cmd.exe";
    3. QStringList arguments =
    4. QStringList() << "/c" << "C:\\Program Files\\Speex\\M_01E.wav";
    5. proc.start(command, arguments);
    To copy to clipboard, switch view to plain text mode 

    What am i missing out now Sir?

  5. #5
    Join Date
    Nov 2006
    Location
    indonesia
    Posts
    55
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Command Prompt command through Qt Application

    Hi,
    Please try this :
    Qt Code:
    1. QProcess proc;
    2. QString command = "C:\\windows\\system32\\cmd.exe";
    3. QStringList arguments =
    4. QStringList() << "/c" << "C:\\Program Files\\Speex\\speexenc M_01E.wav new.spx";
    5. proc.start(command, arguments);
    To copy to clipboard, switch view to plain text mode 

    Best regards,

    myta

  6. #6
    Join Date
    Jul 2014
    Posts
    46
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Command Prompt command through Qt Application

    Still not working.

  7. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Command Prompt command through Qt Application

    Do you get any errors?
    What is the return code?

    Cheers,
    _

Similar Threads

  1. Where can i found QT 5.1.0 command prompt
    By AsfK in forum General Programming
    Replies: 5
    Last Post: 28th August 2020, 11:42
  2. Replies: 7
    Last Post: 20th October 2012, 13:44
  3. Replies: 7
    Last Post: 6th June 2012, 07:48
  4. Qt Command Prompt
    By stijn in forum Installation and Deployment
    Replies: 0
    Last Post: 4th June 2012, 14:15
  5. Replies: 3
    Last Post: 9th March 2011, 12:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.