PDA

Click to See Complete Forum and Search --> : Why I lost my data?


Ander
Feb 13th, 2001, 10:14 PM
Why the data of the array is erased?

strcut rgbtriple
{
unsigned char red;
unsigned char green;
unsigned char blue;
};

struct rgbquad
{
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char reserved;
};

rgbtriple rgb[256];
rgbquad pallete[256];

// other code here

for (int nCount = 0; nCount < 256; nCount++)
{
pallete[nCount].red = rgb[nCount].red;
pallete[nCount].green = rgb[nCount].green;
pallete[nCount].blue = rgb[nCount].blue;
pallete[nCount].red = 0;
}





when nCount becomes 1 then all data in rgb is erased.
Can anybody help me.

Thx...

parksie
Feb 14th, 2001, 08:32 AM
pallete[nCount].red = rgb[nCount].red;
pallete[nCount].green = rgb[nCount].green;
pallete[nCount].blue = rgb[nCount].blue;
pallete[nCount].red = 0;

Shouldn't that last one be .reserved?

Ander
Feb 14th, 2001, 07:17 PM
Yes, I wrote it worng, but in my code file it is reserved.

HarryW
Feb 15th, 2001, 03:09 AM
I think you should know that it is spelt palette. Just because if you use DirectX or something like that you'll need to spell it right.

Apart from that, I can't see much wrong with your code. Is there any other code you haven't posted that might affect it?