Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Learning
  3. Qt in Education
  4. Including external text files into the Qt project
QtWS25 Last Chance

Including external text files into the Qt project

Scheduled Pinned Locked Moved Solved Qt in Education
4 Posts 3 Posters 1.4k 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.
  • R Offline
    R Offline
    Rami
    wrote on 29 Nov 2019, 17:27 last edited by
    #1

    Hello everyone

    I have some text files that I'm reading on PC in a certain directory
    and I would like to somehow include these text files in my Qt project
    so that my app won't have troubles trying to load them when I run the app from my moblie phone or from an emulator

    I'm using FILE as a pointer and fopen()and fgets()
    so I want to "add an exisiting file" and use the relative path in my Qt project
    so these files will become a part of my project

    How can I do this ?
    Or is there a topic about such a problem?

    O 1 Reply Last reply 29 Nov 2019, 17:38
    0
    • R Rami
      29 Nov 2019, 17:27

      Hello everyone

      I have some text files that I'm reading on PC in a certain directory
      and I would like to somehow include these text files in my Qt project
      so that my app won't have troubles trying to load them when I run the app from my moblie phone or from an emulator

      I'm using FILE as a pointer and fopen()and fgets()
      so I want to "add an exisiting file" and use the relative path in my Qt project
      so these files will become a part of my project

      How can I do this ?
      Or is there a topic about such a problem?

      O Offline
      O Offline
      ODБOï
      wrote on 29 Nov 2019, 17:38 last edited by ODБOï
      #2

      @Rami hi
      you can add the files to your resources https://doc.qt.io/qt-5/resources.html

      1 Reply Last reply
      4
      • R Offline
        R Offline
        Rami
        wrote on 29 Nov 2019, 17:54 last edited by
        #3

        @LeLev Thank you very much, it helped 😍

        P 1 Reply Last reply 29 Nov 2019, 18:08
        0
        • R Rami
          29 Nov 2019, 17:54

          @LeLev Thank you very much, it helped 😍

          P Offline
          P Offline
          Pablo J. Rogina
          wrote on 29 Nov 2019, 18:08 last edited by
          #4

          @Rami just in case, keep in mind that files inside the Qt resource system should be read-only.

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          2

          1/4

          29 Nov 2019, 17:27

          • Login

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