下面是一個(gè)簡單的實(shí)現(xiàn)實(shí)例:
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
QTextStream in(&file);
QString text;
text = in.readAll();
file.close();
下面是一個(gè)簡單的實(shí)現(xiàn)實(shí)例:
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
QTextStream in(&file);
QString text;
text = in.readAll();
file.close();