|
Following the last email I don't see any options to change chunk
size when copying a file to the remote computer:
#include <libssh/sftp.h>
#include <sys/stat.h>
#include <fcntl.h>
int sftp_helloworld(ssh_session session, sftp_session sftp)
{
int access_type = O_WRONLY | O_CREAT | O_TRUNC;
sftp_file file;
const char *helloworld = "Hello, World!\n";
int length = strlen(helloworld);
int rc, nwritten;
...
file = sftp_open(sftp, "helloworld/helloworld.txt",
access_type, S_IRWXU);
if (file == NULL)
{
fprintf(stderr, "Can't open file for writing: %s\n",
ssh_get_error(session));
return SSH_ERROR;
}
nwritten = sftp_write(file, helloworld, length);
if (nwritten != length)
{
fprintf(stderr, "Can't write data to file: %s\n",
ssh_get_error(session));
sftp_close(file);
return SSH_ERROR;
}
rc = sftp_close(file);
if (rc != SSH_OK)
{
fprintf(stderr, "Can't close the written file: %s\n",
ssh_get_error(session));
return rc;
}
return SSH_OK;
}
On 11/14/2016 08:28 AM, Mani Amoozadeh
wrote:
|
- 'Short sftp packet error' in libssh Mani Amoozadeh
- Re: 'Short sftp packet error' in libssh Andreas Schneider
- Re: 'Short sftp packet error' in libssh Mani Amoozadeh
- Re: 'Short sftp packet error' in libssh Mani Amoozadeh
- Re: 'Short sftp packet error' in libssh Mani Amoozadeh
- Re: 'Short sftp packet error' in libssh Andreas Schneider
