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. [SOLVED]file permission
QtWS25 Last Chance

[SOLVED]file permission

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.7k 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.
  • saeedhardanS Offline
    saeedhardanS Offline
    saeedhardan
    wrote on last edited by
    #1

    hi ,
    why do i get this error :
    [quote]
    C2065: 'S_IWUSR' : undeclared identifier
    [/quote]
    although i included :
    [quote]
    #include <sys/types.h> //Specified in man 2 open
    #include <sys/stat.h>
    #include <stdlib.h>
    #include <errno.h> //Allows use of error numbers
    #include <fcntl.h> //Specified in man 2 open
    #include <stdio.h>
    [/quote]

    I'm using Qt Creator 3.1.2 to develop c++ . thanks .

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

      Some details about the problem will help. What are you trying to do ? When do you get this error ? What is your program doing ?

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

      1 Reply Last reply
      0
      • saeedhardanS Offline
        saeedhardanS Offline
        saeedhardan
        wrote on last edited by
        #3

        sorry for that .
        @ ssh_session ssh = acs_session.get_ftp_ssh();
        sftp_session sftp;
        int rc;
        sftp = sftp_new(ssh);
        if (sftp == NULL)
        {
        std::string err = ssh_get_error(ssh);
        QWidget tmp;
        QMessageBox::critical(&tmp,QObject::tr("Error"),QObject::tr("Error allocating SFTP session: ")+ QString(err.c_str())+ QObject::tr("\n"));
        return false;
        }
        rc = sftp_init(sftp);
        if (rc != SSH_OK)
        {
        std::string err = ssh_get_error(ssh);
        QWidget tmp;
        QMessageBox::critical(&tmp,QObject::tr("Error"),QObject::tr("Error initializing SFTP session: ")+QString(err.c_str())+QObject::tr("\n"));
        sftp_free(sftp);
        return rc;
        }
        rc = sftp_mkdir(sftp, acs_session.get_ftp_username(), S_IWUSR);
        if (rc != SSH_OK)@

        this is snippet of the code , basically im using libssh to transfer file to a remote pc , using the function :
        [quote]
        sftp_mkdir(sftp, acs_session.get_ftp_username(), S_IWUSR);
        [/quote]
        im creating a remote directory .
        this is the function:
        @
        int sftp_mkdir (sftp_session sftp, const char *directory, mode_t mode)
        @

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

          S_IWUSR is undeclared identifier. It means that definition is not here anywhere in your program. It must be coming from third party library. Just try to find out this definition in your library package.

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andreyc
            wrote on last edited by
            #5

            I guess that you are using VS studio compiler.
            I don't think it includes S_IWUSR definition. See "this doc":http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx

            I would suggest to define it in your project.
            @
            #define S_IWUSR 00200
            @

            1 Reply Last reply
            0
            • saeedhardanS Offline
              saeedhardanS Offline
              saeedhardan
              wrote on last edited by
              #6

              thanks u very much.

              [quote author="andreyc" date="1410968337"]I guess that you are using VS studio compiler.
              I don't think it includes S_IWUSR definition. See "this doc":http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
              [/quote]
              yeah im using VS :/ .
              on linux it compiles fine .

              also iv'e found all the values of the permissions :
              "File permissions":http://man7.org/linux/man-pages/man2/fstat.2.html

              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