libssh가 필요한 Linux 프로그램에 대한 코드를 작성 중입니다. 튜토리얼 페이지를보고 있었는데 참조로 모든 파라미터를 ssh_options_set()
으로 전달한다는 것을 알았습니다. 왜 그런가요?이 프로그램이 참조로 매개 변수를 전달하는 이유
#include <libssh/libssh.h>
#include <stdlib.h>
int main()
{
ssh_session my_ssh_session;
int verbosity = SSH_LOG_PROTOCOL;
int port = 22;
my_ssh_session = ssh_new();
if (my_ssh_session == NULL)
exit(-1);
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "localhost");
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); //here
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port); //here
...
ssh_free(my_ssh_session);
}
C에서 함수를 오버로드 할 수 없습니다. – pmr