complement to inet_addr() ?

This is a discussion on complement to inet_addr() ? within the C Programming forums, part of the General Programming Boards category; Is there another function that does that opposite of what inet_addr() does? I'd like to print an ip address in ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    13

    complement to inet_addr() ?

    Is there another function that does that opposite of what inet_addr() does?
    I'd like to print an ip address in dotted quad that is already stored in sockaddr_in.in_addr.s_addr in binary.

    Is there a standard function that will allow me to do this, or will i have to write my own? I appreciate any help

  2. #2

    Join Date
    May 2005
    Posts
    1,041
    AFAIK you have you write your own (aren't the addresses stored in the structs you mentioned just a bunch of unions or something?) Been a while since I've done any net programming.
    I'm not immature, I'm refined in the opposite direction.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    13
    Alright thanks. The s_addr member is just an unsigned long int, but I have a feeling that this will be a pain in the ass.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    inet_ntoa is what you want.

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    13
    Great, thanks. Helps me out a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sscanf and 32 bit two's complement
    By The Urchin in forum C++ Programming
    Replies: 4
    Last Post: 10-15-2006, 03:17 AM
  2. two's complement question
    By NetWeirdo in forum C Programming
    Replies: 1
    Last Post: 12-10-2005, 02:36 PM
  3. Two's Complement
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 02-26-2002, 05:52 AM
  4. Question regarding 8/16-bits 2's complement numbers
    By mobius in forum C Programming
    Replies: 1
    Last Post: 09-03-2001, 12:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21