[SOLVED]file permission



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



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



  • 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)
    @



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



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



  • 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


Log in to reply
 

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