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
Forum Updated to NodeBB v4.3 + New Features

Including external text files into the Qt project

Scheduled Pinned Locked Moved Solved Qt in Education
4 Posts 3 Posters 1.6k Views 1 Watching
  • 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 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?

    ODБOïO 1 Reply Last reply
    0
    • R Rami

      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?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on 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 last edited by
        #3

        @LeLev Thank you very much, it helped 😍

        Pablo J. RoginaP 1 Reply Last reply
        0
        • R Rami

          @LeLev Thank you very much, it helped 😍

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on 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

          • Login

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