I have a structure like this :
ex) struct BltInfo
{
bool bUseColor;
union
{
long color;
struct
{
char* imageFilePath;
void* pImageCookie;
};
};
};
and I wanna declare some instances of this structure and initialize them like this :
ex) BltInfo bltInfos[] =
{
{false, "resource.jpg", NULL},
{true, 255}
};
But VC++ complain that "cannot convert from 'char [13]' to 'long'". How am I suppose to do to declare and initialize them?
[edited by - ddungum on March 31, 2003 9:09:57 PM]
Initializing structure which includes union member
You need to pass a pointer to a memory location. Try:
char name[]="resource.jpg";
BltInfo bltInfos[] = {
{false, name, NULL},
{true, 255}
};
First make it work,
then make it fast.
--Brian Kernighan
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
char name[]="resource.jpg";
BltInfo bltInfos[] = {
{false, name, NULL},
{true, 255}
};
First make it work,
then make it fast.
--Brian Kernighan
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement