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

Generic path to a file

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 909 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.
  • JulianJ Offline
    JulianJ Offline
    Julian
    wrote on last edited by
    #1

    Hello, There is a way to assing a particular path to a text file?

    For example I want to create a .txt file on the desktop.
    and How can I assign the file to be created on the desktop regardless of which PC is running the program that will create it?

    greetings and thanks

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      U can look at qdesktopservices class in qt documentation

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      8
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #3

        @Julian Using QStandardPaths.

        QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
        

        Then go with QFile as usual to create the file.

        157

        1 Reply Last reply
        3
        • JulianJ Offline
          JulianJ Offline
          Julian
          wrote on last edited by
          #4

          thanks. There is a class for everything!

          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