Qt World Summit: Register Today!

Run program from cmd

  • I have problem which run program from console.
    If i Click by mouse program all works fine
    If i run from cmd program by full path main program don't realise make new form by

    @this->stat = new statystyki();@

    If I do that
    @cd catalog@
    and run from catalog program is works

    Thanks for help

  • Please provide some more code. Right now it is rather impossible to say what goes wrong. I suspect you have some dependencies on the current path somewhere.

  • "Sample code is here...":http://salamandra-bielsko.cba.pl/Prosit_19.zip

    [Edited link description; mlong]

  • Sounds like a path problem to me. First of all you have to specify your architecture, I suspect it is windows and therefore you can right click on the icon and see from which path it is executed.
    Second I don't think anyone will read your program without any clue on what is the real problem.
    Third, doing a simple grep on your source tree reported me that you are using file names as follows:

    @QFile file_2("D:\Prosit\veryf.txt");@

    that enforces my suspect that your application is running with a wrong set of paths.
    Probably not all files are absolute, and this is causing your application to crash. Or maybe your are logging to something and the application does not have permissions in the starting directory.
    I suggest you to place a few debug statement in your application to see where your application stops working, and then report it back to this forum.

  • I would suspect this is related to "this thread":http://developer.qt.nokia.com/forums/viewthread/11271/.

    If you want the developers here to look into your problem, then please boil it down to the absolute minimum that demonstrates the error. Just pointing to a full blown application will most likely not make anyone eager to debug it.

  • HI i have some problem and i rewrite some code
    And i have problem when i start program by command line
    Program is not enter to while in 311 line on mainwindow
    if i Run from windows all is worked

    "Your text to link here...":http://salamandra-bielsko.cba.pl/prosit_23.zip

    i give log when i run by command line and windows
    "Your text to link here...":http://salamandra-bielsko.cba.pl/log.txt

    Somebody have any solutions ??
    Thanks for everything

  • Hello
    I thing problem is read from file read.dat.
    Becouse whan i Make by hand in notepad file all is worked (in windows)
    When i worked with external program which read from scaner and write to file all data this dosent working in scaner is not set sign which close line and file
    function which read look that
    QFile file_1(path_read);
    if (!file_1.open(QIODevice::ReadOnly | QIODevice::Text))
    QTextStream in(&file_1);
    while (!in.atEnd()) {
    QString line_1 = in.readLine();

    Somebody can tell me o which sign must be on end file becouse i can set only one sign in scaner or mayby someone have any othter idea to read from file


    Edit: please take a bit more care in formatting your posts. Put @ signs around code sections, and make sure hyperlinks have a sensible text (instead of "your text to link here..."); Andre

  • Sorry, I do not understand what you want to do.

    Can you describe more clearly which program tries to write what and when?

    What is that scanner and how is it involved in the whole process and is it relevant to the problem?

    Why do you set file permissions to writable if you read from the file?

    In case the open fails, your textstream works on a closed file!

    Your while loop is not terminated, the curly brace } is missing.

  • It is not clear at all, but are you sure your "external" application is really writing to that file? Are you sure when you start reading from such file the other application has flushed buffers and made data persistent? Are you sure the file_1 close is not within the while loop?
    Is it possible to see some debug output?

Log in to reply