Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Not printing whole output as it is from console to txt file
Forum Updated to NodeBB v4.3 + New Features

Not printing whole output as it is from console to txt file

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 839 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jay5121

    QFile file("C:/work/Validation/tools/ValidationReportViewerTool/Degrade_Data.txt");
    if(file.remove()){
    qDebug()<< "previous file removed";

    // QString filePath = "C:/Degrade_Data.txt";
    // QFile::remove(filePath);

                    QFile newFile("C:/Degrade_Data.txt");
                    if (newFile.open(QIODevice::ReadWrite | QIODevice::Text)) {
    

    // qDebug()<<"write";
    QTextStream stream(&newFile);
    QString content = stream.readAll();

                    stream << "\n\nTest Case Name :  " << degraded_testcase_name <<"\nSup Release :  " << db->m_sup_release[other_degrade_tag_index] << "\nTag Name :  " << db->m_tag[other_degrade_tag_index] << "\nCOMMIT ID :  " << db->m_commit_id[other_degrade_tag_index] << "\nJob link : " << db->test_results[other_degrade_tag_index][degraded_testcase_name].m_joblink << "\nFailing traces link :  " << db->test_results[other_degrade_tag_index][degraded_testcase_name].m_artifactlink << "\nPassing traces link :  " << db->test_results[ref_degrade_tag_index][degraded_testcase_name].m_artifactlink;
                qDebug() <<"writing close";
    
    
            qDebug() << "[Failure info from Degrade Check]";
            qDebug() << "Test Case Name :  " << degraded_testcase_name;
            qDebug() << "Sup Release :  " << db->m_sup_release[other_degrade_tag_index];
            qDebug() << "Tag Name :  " << db->m_tag[other_degrade_tag_index];
            qDebug() << "COMMIT ID :  " << db->m_commit_id[other_degrade_tag_index];
            qDebug() << "Job link :  " << db->test_results[other_degrade_tag_index][degraded_testcase_name].m_joblink;
            qDebug() << "Failing traces link :  " << db->test_results[other_degrade_tag_index][degraded_testcase_name].m_artifactlink;
            qDebug() << "Passing traces link :  " << db->test_results[ref_degrade_tag_index][degraded_testcase_name].m_artifactlink;
            file.close();
            newFile.close();
                  }
    
        }
    

    }

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #2

    @Jay5121
    Hello and welcome.

    Please user the forum tags (the </> icon) for blocks of code, or put ``` (3 backticks) above and below.

    The file you are removing is not the same path as the file you are creating. Why do you open the new file ReadWrite? Why do you read from it? Where do you expect the new output to go? What is your actual question?

    J 1 Reply Last reply
    0
    • JonBJ JonB

      @Jay5121
      Hello and welcome.

      Please user the forum tags (the </> icon) for blocks of code, or put ``` (3 backticks) above and below.

      The file you are removing is not the same path as the file you are creating. Why do you open the new file ReadWrite? Why do you read from it? Where do you expect the new output to go? What is your actual question?

      J Offline
      J Offline
      Jay5121
      wrote on last edited by
      #3

      @JonB hello all that qDebug things i have to print that in txt file which created automatically

      jsulmJ JonBJ 2 Replies Last reply
      0
      • J Jay5121

        @JonB hello all that qDebug things i have to print that in txt file which created automatically

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @Jay5121 What about this part from @JonB : "The file you are removing is not the same path as the file you are creating"?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        J 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Jay5121 What about this part from @JonB : "The file you are removing is not the same path as the file you are creating"?

          J Offline
          J Offline
          Jay5121
          wrote on last edited by
          #5

          @jsulm yes its mistake here but in my code i put same path

          jsulmJ 1 Reply Last reply
          0
          • J Jay5121

            @JonB hello all that qDebug things i have to print that in txt file which created automatically

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #6

            @Jay5121 said in Not printing whole output as it is from console to txt file:

            @JonB hello all that qDebug things i have to print that in txt file which created automatically

            And? You write that to the file with the

            stream << "\n\nTest Case Name :  " << degraded_testcase_name <<"\nSup Release :  " << db->m_sup_release[other_degrade_tag_index] << ...
            

            line.

            I invited you to describe your actual question, or what is actually wrong. We realize English may not be your first language, that is not a problem, but think about what we can tell from what you have written so far. You really need to take time to tell/show us what the problem is.

            1 Reply Last reply
            0
            • J Jay5121

              @jsulm yes its mistake here but in my code i put same path

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @Jay5121 "Not printing whole output as it is from console to txt file" - what exactly does this mean, please?
              Did you do any debugging to see what happens?
              Your code also makes no sense to me: you delete the file and open it again and then try to read from it and expect to see something. How should that work?! The new file is empty...

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Jay5121 "Not printing whole output as it is from console to txt file" - what exactly does this mean, please?
                Did you do any debugging to see what happens?
                Your code also makes no sense to me: you delete the file and open it again and then try to read from it and expect to see something. How should that work?! The new file is empty...

                J Offline
                J Offline
                Jay5121
                wrote on last edited by
                #8

                @jsulm in project i have to select some degrade and need to check failing status how much degrades are failing and which are failing i need data of that degrades or test case ex test case name commit id etc that printing in console and i had copy paste that data in txt file before but i check that with this tool we can automatically create new txt and print that data in txt directly and why i remove bcos i have to check degrades for updated release in every week thats why i need to remove old data from file and auto put new(updated ) data in txt file when ran qt

                JonBJ 1 Reply Last reply
                0
                • J Jay5121

                  @jsulm in project i have to select some degrade and need to check failing status how much degrades are failing and which are failing i need data of that degrades or test case ex test case name commit id etc that printing in console and i had copy paste that data in txt file before but i check that with this tool we can automatically create new txt and print that data in txt directly and why i remove bcos i have to check degrades for updated release in every week thats why i need to remove old data from file and auto put new(updated ) data in txt file when ran qt

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #9

                  @Jay5121
                  None of this answers any of the questions. You don't say what is wrong in the text file compared against the qDebug() statements. You have done nothing about explaining why you do the opens you do. You have not put in anything to debug. You won't get an answer until you actually explain.

                  J 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @Jay5121
                    None of this answers any of the questions. You don't say what is wrong in the text file compared against the qDebug() statements. You have done nothing about explaining why you do the opens you do. You have not put in anything to debug. You won't get an answer until you actually explain.

                    J Offline
                    J Offline
                    Jay5121
                    wrote on last edited by
                    #10

                    @JonB i just need to know that is my all syntax are correct and this is just snipet whole code are saperated in many files

                    jsulmJ JonBJ 2 Replies Last reply
                    0
                    • J Jay5121

                      @JonB i just need to know that is my all syntax are correct and this is just snipet whole code are saperated in many files

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      @Jay5121 I give up sinse you do not answer questions...

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      J 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Jay5121 I give up sinse you do not answer questions...

                        J Offline
                        J Offline
                        Jay5121
                        wrote on last edited by
                        #12

                        @jsulm i did check reply please

                        1 Reply Last reply
                        0
                        • J Jay5121

                          @JonB i just need to know that is my all syntax are correct and this is just snipet whole code are saperated in many files

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #13

                          @Jay5121 said in Not printing whole output as it is from console to txt file:

                          i just need to know that is my all syntax are correct

                          You know that your syntax is correct if it compiles. You know your syntax is wrong if when you compile you get a syntax error.

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved