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 352 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.
  • mangekoyuM Offline
    mangekoyuM Offline
    mangekoyu
    wrote on 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?

    jsulmJ 1 Reply Last reply
    0
    • mangekoyuM mangekoyu

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      • Login

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