Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I downloaded libyahoo2 and I'm trying to login but get a segmentation fault when the yahoo_login() function is called. Here's the code I'm using:

C++
#include <stdio.h>
#include <liblyahoo2/yahoo2.h>
#include <libyahoo2/yahoo2_callbacks.h>

int main(int argc, char **argv)
{
    int id;

    id = yahoo_init(argv[1], argv[2]);
    yahoo_login(id, 0);  //this is where I get the seg fault
    yahoo_close(id);

    return 0;
}


I've been all over google and haven't found a solution
Posted
Comments
Chuck O'Toole 12-Oct-12 22:38pm    
What are the command line arguments? Are you sure there are two of them, "Username" and "password". A null for either will cause a crash, you should check in the code for either argv[1] or argv[2] being null before using them to protect against bad command line invocation.
doughyi8u 12-Oct-12 22:48pm    
yes, there's only two args to yahoo_init(username, password). I've even tried using a call like:
yahoo_init("username", "password");
Andrewpeter 12-Oct-12 22:38pm    
What is prototype of yahoo_login() function?
doughyi8u 12-Oct-12 22:54pm    
yahoo_login(int id, ENUMERATION_TYPE);

where id is the return value of init_yahoo("username", "password") and ENUMERATION TYPE is a value called from enum yahoo_status. 0 is AVAILABLE and should work according to http://libyahoo2.sourceforge.net/README
Richard MacCutchan 13-Oct-12 3:19am    
What is the value of id on return from yahoo_init()?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900