// JP opened flex table

Click to See Complete Forum and Search --> : Replacing inet_ntoa


Salvadoravi
May 11th, 2008, 03:00 PM
Hi guys,

I use inet_ntoa to get the ip address from packets I capture.
To use it I must include winsock.
I would like to write a function of my own to achieve the same goal so I don't have to use winsock (I want to make my program as independent as possible) is there a way to do that??
Can someone please guide me ?

Many thank points are granted 8-)

Edders
May 12th, 2008, 05:39 AM
In an embedded application I have in the past resorted to using a sprintf like solution. A bit like this -
sprintf( String, "%d.%d.%d.%d", Byte1, Byte2, Byte3, Byte4 );of course you first need to split the original DWORD containing 32 bits IP4 address into the 4 bytes used in the print routine.

//JP added flex table