creating buffers in a memory allocated void area??
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
Hi,
I have a free memory area to which I'm having a void pointer (ptrMemory).
Now I would like to split that area into some buffer arrays of different
kinds like e.g. having a float pointer pointing at the first byte location
in my memory area and having a WORD pointer pointing at 100 floats later in
the memory area. Could be written like this (I know it isn't the correct way
to do it but it explain what i want to do):
float *ptrFloatBuffer;
WORD *ptrWordBuffer;
ptrFloatBuffer = (float*)ptrMemory;
ptrWordBuffer = (float*)(ptrMemory + 100 * sizeof(float);
100 * sizeof(float) is illegal because the compiler don't know that we're
talking about bytes here, but how should it be done???
Thanks
Ole
.
Relevant Pages
- Re: nibble array/BCD notation/MMX
... bits of C are used is because C is usually an offset. ... and many pointers pointing to that memory area. ... if you are using offsets from a base pointer instead of a pointer ... (comp.lang.asm.x86) - Re: Degenerate strcmp
... Standard alter your belief? ... returned pointer shall not be used to access an object." ... that memory obtained from mallocbe "disjoint" from all other ... pointed to by p1 is not disjoint to the memory area pointed ... (comp.lang.c) - Re: Thread attach memory management
... I'm asking about other buffers around pointer cause ... If the same DLL is loaded by two or more different ... where the parameter Output_Image is a pointer to a proper memory area; the C++ dll use the g_Output_Image pointer initialized to a memory area belonging to the first process. ... MainThread() try to read data into g_Output_Image ptr, ... (microsoft.public.windowsce.embedded.vc) - Re: creating buffers in a memory allocated void area??
... Ole wrote: ... I have a free memory area to which I'm having a void pointer. ... kinds like e.g. having a float pointer pointing at the first byte ... (microsoft.public.windowsce.embedded.vc) - Re: creating buffers in a memory allocated void area??
... Ole wrote: ... I have a free memory area to which I'm having a void pointer. ... Now I would like to split that area into some buffer arrays of different kinds like e.g. having a float pointer pointing at the first byte location in my memory area and having a WORD pointer pointing at 100 floats later in the memory area. ... (microsoft.public.windowsce.embedded.vc) |
|