Not printing whole output as it is from console to txt file
-
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(); } }
}
-
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(); } }
}
@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? -
@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? -
@JonB hello all that qDebug things i have to print that in txt file which created automatically
-
-
@JonB hello all that qDebug things i have to print that in txt file which created automatically
@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.
-
@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... -
@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...@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
-
@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
@Jay5121
None of this answers any of the questions. You don't say what is wrong in the text file compared against theqDebug()
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. -
@Jay5121
None of this answers any of the questions. You don't say what is wrong in the text file compared against theqDebug()
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. -
@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
-
@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
@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.