Thread: gethostbyname and structs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    UNIX chick
    Join Date
    Mar 2003
    Posts
    92
    The casting in the last code snippet screams confusion to me. I get that inet_ntoa() takes a struct of the type in_addr, but why the * both in front of the cast and inside the parentheses (*(struct in_addr*))?

    I read the sockets guide earlier today, but I'm still lost when it comes to the structs. I don't even get if the struct is the data type, or the type of the struct, for example in_addr, is the data type. Can someone clarify this?

    Thank you for your help, btw.

  2. #2
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    read the bottom lines of page 22 in the beej guide.
    it will explain the "weirdness" of this specific casting.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed