Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-19-2006, 12:01 AM
|
#1
|
|
Member
Registered: Dec 2005
Posts: 73
Rep:
|
IPv6 address ?????????
Hi,
To check IPv4 address, we are having inet_addr().
For IPv6 address ?
I want to check IPv6 address ,after entring manually....
any help?????????
|
|
|
|
06-19-2006, 01:04 AM
|
#2
|
|
Member
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600
Rep:
|
This comes from the libc manual,
Code:
#include <arpa/inet.h>
-- Function: int inet_pton (int AF, const char *CP, void *BUF)
This function converts an Internet address (either IPv4 or IPv6)
from presentation (textual) to network (binary) format. AF should
be either `AF_INET' or `AF_INET6', as appropriate for the type of
address being converted. CP is a pointer to the input string, and
BUF is a pointer to a buffer for the result. It is the caller's
responsibility to make sure the buffer is large enough.
|
|
|
|
06-19-2006, 01:38 AM
|
#3
|
|
Member
Registered: Dec 2005
Posts: 73
Original Poster
Rep:
|
Hi,
I am entring ipv6 address manually...
I want to check like inet_addr(ipaddr)...
how can I use this one?
|
|
|
|
06-19-2006, 03:13 AM
|
#4
|
|
Member
Registered: Aug 2003
Location: Belguim, Ostend and Ghent
Distribution: Ubuntu
Posts: 600
Rep:
|
Just like the docs say, I included a minimal example. When all goes well, 0 is returned, else -1 is returned.
Code:
struct in6_addr output;
char* input;
// READ THE INPUTSTRING INTO INPUT
if(inet_pton(AF_INET6, input, &output)) //Parse input to a binary IPv6 address in output.
{
perror(0);
exit(1);
};
// use your binary IPv6 address called output
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:22 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|