LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

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

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


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

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, 09:49 AM   #2
graemef
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:
Code:
char *inet_ntoa(struct in_addr in);
Check your man page for more details
 
Old 07-17-2006, 12:02 AM   #3
rajesh_b
Member
 
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
u can use inet_ntop also

hi,
check the man page for inet_ntop.

Regards,
rajesh
 
  


Reply


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 04:10 PM
kdevelop error "Cannot find implementation class for form" J3N7iL Linux - Software 0 06-28-2006 01:11 AM
"packed" byte integer,etc kpachopoulos Programming 1 02-09-2006 10:25 AM
form action ="?" ... where is my form posting to? verbatim Programming 2 05-23-2005 07:55 PM
Cannot convert string "%s" to type %s jamaso Slackware 1 05-05-2002 05:06 AM


All times are GMT -5. The time now is 08:11 AM.

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