Archived

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

array and LPDIRECTDRAW7

This topic is 6274 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

why doesnt this work? typedef struct tsth{ LPDIRECTDRAWSURFACE7 srf; }sth; sth image; LPDIRECTDRAWSURFACE7 surface; LPDIRECTDRAWSURFACE7 array[1]; .. surface = DDLoadBitmap...etc array[0] = surface; //this line doesnt work img->srf = array[0]; anyone?

Share this post


Link to post
Share on other sites
The answer is the line should read:
image.srf = array[0]; // notice not img AND . instead of ->

since image is a struct (not a pointer to a struct) you use the .(dot) operator to access it''s members.

BTW ... are you using C or C++??? you wrote your struct definition in old C style NOT C++ ... in c++ it should be like this:

struct sth{
LPDIRECTDRAWSURFACE7 srf;
};


notice ... no typedef ... and no name following the end brace ... the name gets assigned from the one given between the word struct and the opening brace .. just like classes ...

good luck

Share this post


Link to post
Share on other sites