Samega 7Cattac
Samega 7Cattac

Reputation: 293

Libssh2 - libssh2_scp_recv2 function

Can someone explain me the libssh2_scp_recv2() function from libssh2 lib?

According to this I need to input the session var (LIBSSH2_SESSION *session), the path to the file I want (const char *path) and a struct with information of the file I want (struct_stat *sb).

Where is the part I receive the data from that file? Because what return is a pointer to the channel.

Upvotes: 1

Views: 514

Answers (2)

dev0
dev0

Reputation: 82

There is an example of how to use libssh2_scp_recv2() and libssh2_channel_read() in the file /example/scp.c

I replaced the write(1, mem, rc) there by fwrite (mem, 1, amount, targetFile) to write the buffer content to a file.

Upvotes: 0

Samega 7Cattac
Samega 7Cattac

Reputation: 293

I found the answer! This function is only to make a request to that session and them it's just read it like a ssh output using the libssh2_channel_read() function.

Upvotes: 1

Related Questions