LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-15-2006, 07:57 AM   #1
LQ Newbie
Registered: Jun 2006
Posts: 7

Rep: Reputation: 0
How I can Convert 4 byte IP to an IP string of form ("")

How I can Convert 4 byte IP to an IP string of form ("")

Basically I m receiving an ARP reply using recvfrom() I want to use the IP addresses received. I can get it but not the original because its 4 byte IP i wanna print it as String format how can i do it......... plz tell me.
Old 07-15-2006, 08:49 AM   #2
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
There is a function called inet_ntoa() that should come in handy.

Here is it's prototype:
char *inet_ntoa(struct in_addr in);
Check your man page for more details
Old 07-16-2006, 11:02 PM   #3
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
u can use inet_ntop also

check the man page for inet_ntop.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert "string" type to "char * " in c++ pranavojha Programming 18 06-05-2008 03:10 PM
kdevelop error "Cannot find implementation class for form" J3N7iL Linux - Software 0 06-28-2006 12:11 AM
"packed" byte integer,etc kpachopoulos Programming 1 02-09-2006 09:25 AM
form action ="?" ... where is my form posting to? verbatim Programming 2 05-23-2005 06:55 PM
Cannot convert string "%s" to type %s jamaso Slackware 1 05-05-2002 04:06 AM

All times are GMT -5. The time now is 09:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration