Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

phusnikn

Access a struct member from a struct.. how!!

This topic is 5730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys im playing with libsam LSCI''s File system library it has a struct wiht the following time_t creation; time_t residence_time; struct sam_copy_s copy[MAX_ARCHIVE]; uchar_t cs_algo; uchar_t flags; ulong_t gen; Problem is I''m having difficulties accessing the sam_copy_s struct how would I access this im using Sun Forte C/C++ 6.0 Compiler using Solaris, I havent used C in a very long time thanks for your time. im doing something like struct sam_stat samst; sam_stat("/netb/file1",&samst,sizeof(struct sam_stat)+1); now how do I go about pulling the info from sam_copy_s ?? Thanks for your help guru''s :-) - RB

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
assign both structs together i guess...

scratch that, they''re different structs.
you''ll need to look at the header files or some documentation.
that''s your best bet.


-A_PD

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

  
typedef struct A_
{
int i;

} A;

typedef struct B_
{
int x,y,z;
A data;
} B;

void main( void )
{
B myStruct;

myStruct.data.i = 0;
mystruct.x = 1;
mystruct.Y = 1;
mystruct.z = 1;

}



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!