libssh2_userauth_publickey_fromfile 执行失败

请教哪位大神,我在使用libssh2编写sftp客户端时执行到libssh_2_userauth_publickey_fromfil函数总是失败的,请问为什么呢?调用都是代码就是libssh2自带的测试案例。
if (libssh2_userauth_publickey_fromfile(*session, strUser, "~/.ssh/id_rsa.pub", "~/.ssh/id_rsa", strPass))
{
fprintf(stderr, "\tAuthentication by public key failed!\n");
goto shutdown;
} else {
fprintf(stderr, "\tAuthentication by public key succeeded.\n");
}

~/.ssh/id_rsa和~/.ssh/id_rsa.pub都是本机的秘钥
哪位大神可以指点下。

查看一下返回的错误信息。

 int err = libssh2_userauth_publickey_fromfile()

谢谢你的提醒,我自己解决了。我把地址改成绝对路径他就成功了。谢谢。