look, i know im a noob and i shouldnt be playing around with images yet, but anyway im trying to put a piece of code which loads a bitmap into a function which returns the pointer to an array of bytes which represents the bitmap.


Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>


int main(int argc, char *argv[])
{
    BYTE *lpBits;
    lpBits = loadPicture();
    int i;
    for(i = 0; i < 160; i = i + 4) {
            printf("%d %d %d %d \n", *(lpBits + i), *(lpBits + i + 1), *(lpBits + i + 2), *(lpBits + i + 3));        
    }
    
    

    system("PAUSE");	
    return 0;
}

unsigned int loadPicture()
{
         HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    
         BITMAP bitmap;
         GetObject(hBitMap,sizeof(BITMAP),&bitmap);
         int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
        
        printf("%d %d %d %d \n", bitmap.bmHeight, bitmap.bmWidth, bitmap.bmBitsPixel, size);
     
        BYTE *lpBits = malloc(size);
        
        
        GetBitmapBits((HBITMAP)hBitMap,size,lpBits );
        return lpBits;
}
i basically dont know what the function should return. A pointer is really just an unsigned int, so i tried that and it didnt work. I couldnt really find any examples lying around either. If ive screwed something else up or theres a better way to do something let me know as well, i am just starting at this.