Hello.
I know how to read files but I discovered something weird the code below works fine.
{
QMessageBox::information(this,
"asdasd",
"not exists");
}
if(!file.
open(QFile::ReadOnly)) {
}
QString string
= codec
->toUnicode
(data
);
QFile file(QApplication::applicationDirPath() + "/bilgi.txt");
if(!QFile::exists(QApplication::applicationDirPath() + "/bilgi.txt"))
{
QMessageBox::information(this, "asdasd", "not exists");
}
if(!file.open(QFile::ReadOnly))
{
QMessageBox::information(this, "asdasd", "readonly");
}
QByteArray data = file.readAll();
QTextCodec *codec = QTextCodec::codecForHtml(data);
QString string = codec->toUnicode(data);
QMessageBox::information(this, "asdasd", string);
To copy to clipboard, switch view to plain text mode
But when I remove these codes below
{
QMessageBox::information(this,
"asdasd",
"not exists");
}
if(!file.
open(QFile::ReadOnly)) {
}
if(!QFile::exists(QApplication::applicationDirPath() + "/bilgi.txt"))
{
QMessageBox::information(this, "asdasd", "not exists");
}
if(!file.open(QFile::ReadOnly))
{
QMessageBox::information(this, "asdasd", "readonly");
}
To copy to clipboard, switch view to plain text mode
I can't read bilgi.txt file. I really wonder why it is like that.
Is there a really cool reason for that? or I don't know you tell me.
Bookmarks