Click here to Skip to main content
16,019,976 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
This test code throws expected error

C++
if (file.open(QIODevice::ReadWrite)) {

      file.open(QIODevice::ReadWrite);
      qDebug()<<stderr;


here is Qt console output

" file code block \n QString BT_Utility_Library::ProcessFile(QString, QString, QTextEdit *, QTextEdit *, int) @ line \n115"
0x7339eda1b6a0
QFile::open: File (text.txt) already open
0x7339eda1b6a0
" Success fILE OPEN  "


What I have tried:

I inserted


C++
qDebug()<<stderr;


in few places in my test function, no luck.
Posted

1 solution

Note that I haven't actually tried this but, reading the QT docs[^] indicates that you could probably redirect stderr using something like this:
C++
std::cerr.rdbuf(std::cout.rdbuf());
Do that at the start of the application and cerr should be written to the standard cout buffer (this assumes that you haven't done something daft like redirected cout beforehand).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900