how change the Pointer size inside the function?

Mar 2, 2022 at 9:34pm
see these function that have an argument Pointer:
1
2
3
4
5
6
7
void GetDIBs(BYTE *Pixels)
    {
        int dwLen = bmi.bmiHeader.biWidth *bmi.bmiHeader.biHeight * (BitMap.bmBitsPixel / 8);
        Pixels = (BYTE *)realloc(Pixels, dwLen);
        memset(Pixels, 0, dwLen);
        GetBitmapBits(hBitmap,dwLen,Pixels);
.............

the line:
Pixels = (BYTE *)realloc(Pixels, dwLen);
seems ignored.. why? i can't change the pointer size?
Last edited on Mar 2, 2022 at 9:39pm
Mar 2, 2022 at 9:59pm
What makes you think it is ignored?

Does Pixels point to the beginning of a memory block that was previously created with malloc/calloc/realloc?
Last edited on Mar 2, 2022 at 10:01pm
Mar 2, 2022 at 10:04pm
Note that Pixels is a copy of the pointer that was passed as argument to the GetDIBs function and modifying Pixels inside the function will not automatically update any pointer outside the function.
Last edited on Mar 2, 2022 at 10:05pm
Mar 2, 2022 at 10:06pm
is there a way for do it?
Mar 2, 2022 at 11:57pm
void GetDIBs( BYTE*& Pixels )
Mar 3, 2022 at 9:13pm
thank you so much. works fine.
and i tested that must be: "pointer adressed"(*&) and not "adressed pointer"(&*).
thank you so much for all to all
Topic archived. No new replies allowed.