Reading a .pro file using custom read function
I am trying to read the .pro file of my project and display it on the console window. The reading was done successfully but the displaying was not as expected. The program displays the text as sequential letters:
Code:
QT += core\nQT -= gui\nCONFIG += c++11\nTARGET = 13-ResourceFiles\nCONFIG += console\nCONFIG -= app_bundle\nTEMPLATE = app\n\nSOURCES += main.cpp\n\n
not as :
Code:
QT += core
QT -= gui
CONFIG += c++11
TARGET = 13-ResourceFiles
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Here is the Reading function:
Code:
{
if(myfile.exists())
{
my_buffer=myfile.readAll();
qDebug()<<my_buffer;
myfile.flush();
myfile.close();
}
Re: Reading a .pro file using custom read function
Try this:
Code:
{
if(myfile.exists())
{
QString my_buffer
= stream.
realAll();
qDebug()<<my_buffer;
myfile.close();
}
}
}
Using readAll() is not recommended unless you can assert that the size of the read files is not very large.
Re: Reading a .pro file using custom read function
I can not see any difference in the result. what did you modify?
Re: Reading a .pro file using custom read function
QDebug escapes non-printable characters. Try to change qDebug() with qDebug().noquote().