Ahmed Abdellatif
7th October 2017, 10:39
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:
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 :
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:
void Read(QString file_name)
{
QFile myfile(file_name);
if(myfile.exists())
{
myfile.open(QIODevice::ReadOnly);
QString my_buffer;
my_buffer=myfile.readAll();
qDebug()<<my_buffer;
myfile.flush();
myfile.close();
}
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 :
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:
void Read(QString file_name)
{
QFile myfile(file_name);
if(myfile.exists())
{
myfile.open(QIODevice::ReadOnly);
QString my_buffer;
my_buffer=myfile.readAll();
qDebug()<<my_buffer;
myfile.flush();
myfile.close();
}