inet_pton question

I use FreeBSD5.3,I use inet_pton under c language,like follows:
if(inet_pton(AF_INET6,argv[1],&servaddr.sin6_addr)<=0){
printf("error");
}
else{
printf("ok");
}

Then I run above code,
./a.out 127.0.0.1

It shows "error"! I don't know why it don't show "ok",anyone could tell me the reason and how to do it?

Thanks in advance!
Best regards,
konvalo

inet_pton() returns 0 if the source string does not contain a character string representing a valid network address in the specified address family. You might want to try feeding it an ipv6 address-type character string.