Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I open and read text file with url?
Forum Updated to NodeBB v4.3 + New Features

How can I open and read text file with url?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 354 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mangekoyu
    wrote on 28 Jun 2022, 12:04 last edited by mangekoyu
    #1

    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?

    J 1 Reply Last reply 28 Jun 2022, 12:06
    0
    • M mangekoyu
      28 Jun 2022, 12:04

      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?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 28 Jun 2022, 12:06 last edited by
      #2

      @mangekoyu You need to download that file first to your machine.
      See for example https://stackoverflow.com/questions/26393207/qt-downloading-file-with-qnetworkaccessmanager

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      1/2

      28 Jun 2022, 12:04

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved