[SDL] convert IPaddress to string

Roger D. Vargas roger at ehtsc.co.cu
Mon Jul 17 15:25:08 PDT 2006


El lun, 17-07-2006 a las 12:12 -0700, 1337p337 escribió:
> On 17/07/06, Roger D. Vargas <roger at ehtsc.co.cu> wrote:
> > What is the best way to convert the host member of IPaddress struct to a
> > printable string?
> 
> There doesn't seem to be a function for this in SDL_Net (looking
> briefly over the docs), but you could probably get away with
> sprintf(ip_string, "%s", inet_ntoa((struct in_addr) ip.host);
> 
> Make sure to include sys/socket.h, netinet/in.h, and arpa/inet.h.
> Hope that helps.
> ]
Is tha portable? I was thining in something like decomposing the int in
four bytes and printing them in the string.

> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
-- 
Roger D. Vargas <roger at ehtsc.co.cu>
Formatur Santiago





More information about the SDL mailing list