Results 1 to 4 of 4

Thread: Why I lost my data?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    2

    Question

    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...

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
    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?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Posts
    2
    Yes, I wrote it worng, but in my code file it is reserved.

  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    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?
    Harry.

    "From one thing, know ten thousand things."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width