Results 1 to 8 of 8

Thread: How to communicate with external programs?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    May 2006
    Posts
    68
    Thanks
    10
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default How to communicate with external programs?

    Forked from: http://www.qtcentre.org/forum/f-qt-d...-qt4-4108.html

    THANK YOU VERY MUCH
    I WAS ABLE TO RUN THE APPLICATION ATLAST ....

    I need to first start some processes fromthe mother application ( dialog) on the clickof the pushbutton. I tried the Q process but it didnot work out.Then I resorted to System call . This I know is not a clean process but just to check the slot thing I have put this now.

    my code snippet is as
    steg::steg(QWidget *parent)
    : QDialog(parent)
    {
    ui.setupUi(this);
    connect(ui.okButton, SIGNAL(clicked()), this, SLOT(test()));
    connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(open_file()));
    }

    void steg::test()
    {
    system("e:\"\"\"stego.jpg");
    }
    you see above the okbutton on being clicked gives signal to slot test() .test() function has system call to launch picture viewer to show the file stego.jpg.
    Canyou suggest a better method to do this task.

    Secondly I need to create , open , write , execute and close the file very often in my program on the click of buttons.

    i tried the following snippets

    void steg::writeinfile()
    {
    char eog_comand[]= "eog";
    char space[]= " ";
    FILE *fp;
    fp = fopen ("e:\"\"\"trial.txt", "w+");
    fputs (eog_comand,fp);
    fputs (space,fp);
    fclose(fp);
    }
    this is simple c code .But when i run the program it crashes.
    I tried Qfile commands
    void steg::writeinfile()
    {
    QFile file;
    file.setFileName("e:\"\"\"trial.txt");
    file.open(QIODevice::WriteOnly);
    file.write(msg, qstrlen(msg)); // write to stderr
    file.close();
    }
    But that alsodoesnot work
    Someguidance please.
    Last edited by jacek; 21st October 2006 at 20:39. Reason: added info about original thread

Similar Threads

  1. link error for visual studio.net 2003
    By berlin in forum Newbie
    Replies: 9
    Last Post: 29th September 2006, 16:06
  2. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  3. Can't compile programs in Visual Studio.net 2005
    By xgoan in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2006, 14:10

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.