QFile, accessing samba shares using password (on windows)



  • 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?



  • Good, question have you find a solution?



  • Unfortunately... no.

    I used a public share (without password).



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.