Thread: Structures in C

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    1
    Rep Power
    0

    Question Structures in C


    Is there any way in C to find the fields in a astructure that are pointers to any type.

    TIA,
    Senthil
  2. #2
  3. No Profile Picture
    Offensive Member
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2002
    Location
    in the perfect world
    Posts
    622
    Rep Power
    28
    >>Is there any way in C to find the fields in a astructure that are pointers to any type.

    ???????? Look for the *'s?

    pointers are usually 4 bytes (but so are many other data types)

    Don't you have the structure declaration? If not, why not?

    or do you mean void* ( void pointer will be a pointer to any data type )
    The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

    Frank Zappa
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Flint, MI
    Posts
    328
    Rep Power
    13

    Re: Structures in C


    Originally posted by yusakulisa
    Is there any way in C to find the fields in a astructure that are pointers to any type.
    You really need the structure's definition. Your compiler won't have anything to do with it otherwise. There isn't a safe and reliable way to access the members of a structure when you only have a void* until you cast it to a specific structure.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development
    http://www.lazarusid.com/notes/

IMN logo majestic logo threadwatch logo seochat tools logo