I hope, it is useful for beginning:
#include <QCoreApplication>
#include <QFile>
#include <QTextStream>
#include <QDebug>
int main(int argc, char *argv[])
{
qDebug() << text;
file.close();
}
else {
qDebug() << "Failed to open file for reading";
}
return a.exec();
}
#include <QCoreApplication>
#include <QFile>
#include <QTextStream>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString filePath = "C:/text.txt";
QFile file(filePath);
if (file.open(QFile::ReadOnly | QFile::Text)) {
QTextStream in(&file);
QString text = in.readAll();
qDebug() << text;
file.close();
}
else {
qDebug() << "Failed to open file for reading";
}
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks