Results 1 to 19 of 19

Thread: Program not running exited with code 0

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Nov 2012
    Posts
    12
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Program not running exited with code 0

    Sorry, may be my question is a silly thing, but i am a beginner in both qt and c++ so please tell me weather in my code also it seems the same or not

    Actually my code is


    case SHORT:
    /*write the parsing stuff ..... for parsing the options member of the object to seperate the statement and
    main phrase parts*/
    Ques=((Short *)object)->stmt[0];
    Question=parseQuestion(Ques); // function called for replacing tilde,cape symbol to angluar brackets
    Questemp=Question;
    ((Short *)object)->stmt[0]=Questemp;
    temp = "\"" + chapter + "\", \"" + board + "\", \"" + subject + "\", \"" + temp2.setNum(((baseFillChoose *)object)->pageNo)+ "\", \"" + ((Short *)object)->Queswav + "\",";
    temp += " \"" + ((Short *)object)->stmt[0] + "\",\"" + ((Short *)object)->mgif[0] + "\",\"" + ((Short *)object)->mgif1[0] + "\", \"" + ((Short *)object)->ChooseType + "\", \"" +((Short *)object)->misc[0] + "\"";
    text12="insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp + ");";
    cout<<"text12\n"<<text12<<endl;
    query = new QSqlQuery("insert into ShortQues(Chapter,Board,Subject,PageNo,Queswav,Que stion,Q1Gif1,Q1Gif2,Shorttype,StaticGif1) values (" + temp + ")");
    temp = "";
    index = 0;
    query = new QSqlQuery("select MAX(QNo) as QNo from ShortQues");
    if(!query->first())
    {
    exit(-2);
    }
    qNo = (query->value(0)).toInt();

    for(i = 0;i<object->getNumOpt();i++)
    {
    index = 0;
    while((((Short *)object)->options[i])[index]!='\0') //here it points
    {
    index = parseOption(index,((Short *)object)->options[i],stmt1,phrase);
    cout<<"index : "<<index<<"\n"<<stmt1<<"\n"<<phrase<<endl;
    QString text11;
    stmt1temp=stmt1;
    cout<<"stmt1temp\n"<<stmt1temp<<endl;
    stmt1=stmt1temp;
    cout<<"stmt1\n"<<stmt1<<endl;
    phrasetemp=phrase;
    cout<<"phrasetemp\n"<<phrasetemp<<endl;
    phrase=phrasetemp;
    cout<<"phrase\n"<<phrase<<endl;
    if(index!=-1)
    {

    text11="insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1 + "\", NULL,\"" + phrase + "\"," + temp2.setNum(qNo) + "," + temp2.setNum(((Short *)object)->ptno[i+1]) + ",1)";
    cout<<"\n\ntext11"<<text11<<endl;

    query = new QSqlQuery("insert into ShAnsPts(Statement1,Statement2,Option1,QNo,PointNo ,CorrectNo) values (\"" + stmt1 + "\", NULL,\"" + phrase + "\"," + temp2.setNum(qNo) + "," + temp2.setNum(((Short *)object)->ptno[i+1])+",1)");
    }
    else {
    query = new QSqlQuery("select MAX(APNo) as APNo from ShAnsPts where QNo=" + temp2.setNum(qNo) +"&& PointNo=" + temp2.setNum(((Short *)object)->ptno[i+1]));

    if(!query->first())
    {
    cout<<"There is no main phrase in this point ..... aborting\n";
    exit(-2);
    }
    aPNo = (query->value(0)).toInt();
    cout<<"This is apNo values"<<aPNo<<endl;
    stmt1=parseQuestion(stmt1); // function called for replacing tilde,cape symbol to angluar brackets
    stmt2temp=parseStepNo(stmt1,i,aPNo);
    cout<<"\nThis is the apno value required"<<aPNo<<endl;
    // stmt2temp=stmt1;
    stmt2=stmt2temp;
    cout<<"This is STatement2 value"<<stmt2<<endl;
    // (((baseFillChoose *)object)->stepno[i+1])=stepval[i];
    // cout<<"This is stepmark value"<<stepval[i]<<endl;
    query = new QSqlQuery("update ShAnsPts set Statement2 = \"" + stmt2 + "\" where APNo=" + temp2.setNum(aPNo));
    // query = new QSqlQuery("update ShAnsPts set StepMark = \"" + ((baseFillChoose *)object)->stepno[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
    query = new QSqlQuery("update ShAnsPts set Q1Gif1 = \"" + ((Short *)object)->mgif[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
    query = new QSqlQuery("update ShAnsPts set Q1Gif2 = \"" + ((Short *)object)->mgif1[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
    query = new QSqlQuery("update ShAnsPts set StaticGif1 = \"" + ((Short *)object)->misc[i+1] + "\" where APNo=" + temp2.setNum(aPNo));
    query = new QSqlQuery("update ShAnsPts set voiceover = \"" + ((Short *)object)->voiceovers[i+1] + "\" where APNo=" + temp2.setNum(aPNo));

    }
    }
    }

    break;

    After entering into the following code

    int mainForm:arseOption(int ind,QString option, QString &stmt1, QString &phrase)
    {
    QTextStream cout(stdout, QIODevice::WriteOnly);
    int j = 0;
    int index = ind;
    cout<<"311 : parseOption : "<<option<<endl;
    cout<<"index&&\n"<<index<<endl;
    while(option[index] != '|')
    {
    stmt1[j] = option[index];
    cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
    if(option[index]=='\0')
    {
    stmt1[j] = '\0';
    cout<<"stmt1[j]\n"<<stmt1[j]<<endl;
    option[0] = '\0';
    cout<<"option[0]\n"<<option[0]<<endl;
    return -1;
    }
    index++;
    j++;
    }
    stmt1[j] = '\0';
    cout<<"stmt1[j]**&\n"<<stmt1[j]<<endl;
    stmt1=stmt1.replace( "{sub}","<sub>");
    stmt1=stmt1.replace( "{/sub}","</sub>" );

    cout<<"425 : "<<stmt1<<endl;
    j = 0;
    index++;
    while(option[index] != '\\')
    {
    phrase[j] = option[index];
    index++;
    j++;
    }
    phrase=phrase.replace( "{sub}","<sub>" );
    phrase=phrase.replace( "{sub}","<sub>" );
    cout<<"Phrase value"<<phrase<<endl;
    phrase[j] = '\0';
    cout<<"436 : "<<phrase<<endl;

    return (index + 1);

    }

    then return to the above while condition

    it exit and showing
    ASSERT: "i >= 0" in file /usr/include/qt4/QtCore/qstring.h, line 875
    The program has unexpectedly finished.
    /home/tts/Desktop/QbankEditorAllrequirement/qbank exited with code 0
    Last edited by gayathrisekaran; 8th November 2012 at 08:35. Reason: updated contents

Similar Threads

  1. exited with code -1073741819
    By cic in forum Qt Programming
    Replies: 4
    Last Post: 11th November 2011, 23:39
  2. Running example project with mingw gives "... exited with code -1073741792" error
    By sibercekirge in forum Installation and Deployment
    Replies: 8
    Last Post: 31st May 2011, 17:33
  3. Program exited with code 03
    By Fallen_ in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2010, 23:09
  4. name.exe exited with code 1.
    By Fallen_ in forum Qt Programming
    Replies: 2
    Last Post: 2nd September 2010, 01:17
  5. Replies: 8
    Last Post: 28th January 2010, 06:45

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
  •  
Qt is a trademark of The Qt Company.