Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Reading File From Asset file which is in Build folder

Reading File From Asset file which is in Build folder

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 918 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.
  • Bhushan_SureB Offline
    Bhushan_SureB Offline
    Bhushan_Sure
    wrote on last edited by Bhushan_Sure
    #1

    Hello All,
    As we Know After building An android project on Qt, Build file is generated in Workspace, In that Android-Build file , There is folder known as "Asset", we can move any file from any directory to this "asset folder", I am able to find that a file is present in "asset folder", But i am not able to read it through "Qfile", can anybody knows how to read it ?

    code i have written for reading file :-

    void AssetFileDisplay::displaytext()
    {
        QFile dfile("assets:/Add.txt");
        if (dfile.exists())
        {
          qDebug()<<"Ready to Go";
        }
    
        QTextStream in(&dfile);
        QString line = in.readLine();
        emit complete(line);
    }
    
    J.HilkJ 1 Reply Last reply
    0
    • Bhushan_SureB Bhushan_Sure

      Hello All,
      As we Know After building An android project on Qt, Build file is generated in Workspace, In that Android-Build file , There is folder known as "Asset", we can move any file from any directory to this "asset folder", I am able to find that a file is present in "asset folder", But i am not able to read it through "Qfile", can anybody knows how to read it ?

      code i have written for reading file :-

      void AssetFileDisplay::displaytext()
      {
          QFile dfile("assets:/Add.txt");
          if (dfile.exists())
          {
            qDebug()<<"Ready to Go";
          }
      
          QTextStream in(&dfile);
          QString line = in.readLine();
          emit complete(line);
      }
      
      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Bhushan_Sure
      a general question,

      are you aware of Qt's platform independed ressource system ? http://doc.qt.io/qt-5/resources.html
      From this and your last topic, I think you may not be aware of it's existence.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3
      • M Offline
        M Offline
        mvuori
        wrote on last edited by
        #3

        You haven't opened the file before trying to open the stream,

        Bhushan_SureB 1 Reply Last reply
        4
        • M mvuori

          You haven't opened the file before trying to open the stream,

          Bhushan_SureB Offline
          Bhushan_SureB Offline
          Bhushan_Sure
          wrote on last edited by
          #4

          @mvuori You are right, Thank you very much.
          @J-Hilk Thank you, For some new suggestions, i would like implement this. :)

          1 Reply Last reply
          0

          • Login

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