How can I open and read text file with url?
-
I want read a rext file from url. I tried this code;
QFile file1("http:/website.com/dtl/version.txt"); file1.open(QIODevice::ReadOnly | QIODevice::Text); QString dataString1 = file1.readAll(); qDebug() << dataString1;
And I got this error;
QIODevice::read (QFile, "http:\\whilone.com\dtl\version.txt"): device not open ""
How Can I fix this issue? Please can someone help me?
-
I want read a rext file from url. I tried this code;
QFile file1("http:/website.com/dtl/version.txt"); file1.open(QIODevice::ReadOnly | QIODevice::Text); QString dataString1 = file1.readAll(); qDebug() << dataString1;
And I got this error;
QIODevice::read (QFile, "http:\\whilone.com\dtl\version.txt"): device not open ""
How Can I fix this issue? Please can someone help me?
@mangekoyu You need to download that file first to your machine.
See for example https://stackoverflow.com/questions/26393207/qt-downloading-file-with-qnetworkaccessmanager