Thread: bitwise right shipt on unsigned char * | ERROR

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    68

    Exclamation bitwise right shipt on unsigned char * | ERROR

    Hi EveryOne,

    I am having problem oprating bitwise right shift, which is >> on unsigned char *. Do you know why here is my code...

    Please help !!!!!!!!!!!!!!
    Code:
    	DWORD ImageSize = ((DWORD)bmfh.bfSize-sizeof(BITMAPFILEHEADER));
    	LPBYTE pImage = (LPBYTE)malloc(ImageSize);
    	memcpy(pImage,pbmih,ImageSize);	
    
        
    	if(!pImage){
    		return FALSE;
    	}	
    
    	/*int index = 0;
    	rgb_picture image;
    	
    
       for (index=0; index<256; index++)
        {
               /******* Problem starts right here**********/
              /*********pImage >>= 2    ***************/
    
    		// get the red component
    	    strcpy(reinterpret_cast<char *>(&image.palette[index].red),reinterpret_cast<char *>(pImage >>= 2));
    
    		// get the green component
    	    strcpy(reinterpret_cast<char *>(&image.palette[index].green),reinterpret_cast<char *>(pImage >>= 2));
    
    		// get the blue component
    	    strcpy(reinterpret_cast<char *>(&image.palette[index].blue),reinterpret_cast<char *>(pImage >>= 2));
    
        } // end for index
    	
    	FILE *fpr,*fpg,*fpb;
    
    	
    	if (((fpr=fopen("red","wb"))==NULL) || ((fpg=fopen("green","wb"))==NULL) || ((fpb=fopen("blue","wb"))==NULL))
    		return -1;
    
    	if (fwrite(((void *)image.palette[index].red),256,1,fpr)!=1)
    		return -1;
    
    	if (fwrite(((void *)image.palette[index].green),256,1,fpg)!=1)
    		return -1;
    
    	if (fwrite(((void *)image.palette[index].blue),256,1,fpb)!=1)
    		return -1;*/

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I don't understand what you're doing... And, I gotta get going... so I apologize if I'm on the wrong track...

    Are you trying to bit-shift a pointer??? Because it seems to me that would be a weird thing to do. What are you trying to do? Are you decreasing color levels by right-shifting? Maybe you're not de-referencing the pointer?

    Are you trying to shift a pixel? If so, bit-shifting is not what you want to do.

    And what is the problem? Compile error? Wrong results?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  4. How do i un-SHA1 hash something..
    By willc0de4food in forum C Programming
    Replies: 4
    Last Post: 09-14-2005, 05:59 AM
  5. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM