This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
#include <QDebug> | |
#include <QFile> | |
#include <QTextCodec> | |
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), | |
ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); | |
QFile file("D:\\soft\\pleiades\\xampp\\htdocs\\www\\test.html"); | |
QTextCodec* codec = QTextCodec::codecForName("UTF-8"); | |
if (!file.open(QIODevice::ReadOnly))//読込のみでオープンできたかチェック | |
{ | |
qDebug() << "データ読み込み失敗" ; | |
}else{ | |
qDebug() << "データ読み込み成功" ; | |
} | |
QTextStream in(&file); | |
in.setCodec( codec ); | |
while (!in.atEnd()) { | |
qDebug() << in.readLine(); | |
} | |
} | |
MainWindow::~MainWindow() | |
{ | |
delete ui; | |
} | |
0 件のコメント:
コメントを投稿