J
JoeC
I am trying to create a windows program that reads binary graphics as
a resource. This has nothing to do with win32 but conversion of data
with memcpy.
graphic::graphic(UINT uiResID, HINSTANCE hinstance){
size = 32;
bitData.clear();
void * p = NULL; // point to the data
int end;
BYTE data;
static HGLOBAL hglob;
HRSRC hRes =
FindResource(hinstance,MAKEINTRESOURCE(uiResID),TEXT("BINARY"));
if(hRes){
hglob = LoadResource(hinstance,hRes);
p = LockResource(hglob);
memcpy((int*) &end, p, sizeof(int)); // puts the first but of
data to int.
for(int lp = 0; lp != end; lp++){
bitData.push_back(0);
}
for(int lp = 0; lp != end; lp++){
memcpy((BYTE*) &bitData[lp], p, sizeof(BYTE)); puts the rest
of the data in BYTE type.
}
}
set();
create();
}
My question is how do I extract each but of data from p first to the
int type with is the number of data bits then each bit of data to put
into my bitData vector. I can't increase the pointer p++ to get to
the next bit of data. This compiles and runs but does not extract the
data for me.
a resource. This has nothing to do with win32 but conversion of data
with memcpy.
graphic::graphic(UINT uiResID, HINSTANCE hinstance){
size = 32;
bitData.clear();
void * p = NULL; // point to the data
int end;
BYTE data;
static HGLOBAL hglob;
HRSRC hRes =
FindResource(hinstance,MAKEINTRESOURCE(uiResID),TEXT("BINARY"));
if(hRes){
hglob = LoadResource(hinstance,hRes);
p = LockResource(hglob);
memcpy((int*) &end, p, sizeof(int)); // puts the first but of
data to int.
for(int lp = 0; lp != end; lp++){
bitData.push_back(0);
}
for(int lp = 0; lp != end; lp++){
memcpy((BYTE*) &bitData[lp], p, sizeof(BYTE)); puts the rest
of the data in BYTE type.
}
}
set();
create();
}
My question is how do I extract each but of data from p first to the
int type with is the number of data bits then each bit of data to put
into my bitData vector. I can't increase the pointer p++ to get to
the next bit of data. This compiles and runs but does not extract the
data for me.