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. QFile, accessing samba shares using password (on windows)
Forum Updated to NodeBB v4.3 + New Features

QFile, accessing samba shares using password (on windows)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.3k Views 2 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.
  • L Offline
    L Offline
    luca
    wrote on last edited by
    #1

    Hi all,
    I need to read a file in a samba server using username and password.

    To read the file in windows I use the following address:
    @
    \192.168.0.2\doc\aaaa.txt
    @

    it ask me username and password and I can read the file.

    If I use this:
    @
    QFile("\\192.168.0.2\doc\aaaa.txt")
    @

    it can't read the file because of authentication.

    How can I pass username and password to QFile to access the file?

    N 1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #2

      Good, question have you find a solution?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca
        wrote on last edited by
        #3

        Unfortunately... no.

        I used a public share (without password).

        1 Reply Last reply
        0
        • L luca

          Hi all,
          I need to read a file in a samba server using username and password.

          To read the file in windows I use the following address:
          @
          \192.168.0.2\doc\aaaa.txt
          @

          it ask me username and password and I can read the file.

          If I use this:
          @
          QFile("\\192.168.0.2\doc\aaaa.txt")
          @

          it can't read the file because of authentication.

          How can I pass username and password to QFile to access the file?

          N Offline
          N Offline
          noraty18
          wrote on last edited by
          #4

          I don't think Windows allows access to remote shares using the C/C++ API, you probably have to go through WinAPI calls for the SMB protocol. You can implement a QAbstractFileEngine for it and use it with QFile then. But I don't think a ready to use solution is available right now. And you can check if this about passowrd on Windows can help

          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