[SOLVED]file permission
-
wrote on 17 Sept 2014, 10:07 last edited by
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 ?
-
wrote on 17 Sept 2014, 12:20 last edited by
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.
-
wrote on 17 Sept 2014, 15:38 last edited by
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.aspxI would suggest to define it in your project.
@
#define S_IWUSR 00200
@ -
wrote on 18 Sept 2014, 14:57 last edited by
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
4/6