right so, if i am reading in a binary file and want to flip all the bytes that are read in, and the bytes read are 4096... how do i flip all the bits...????
i have the following function:
void ReadFile( void *buffer)
{
fread(buffer,4096,1,infile);
// this doesnt work:
binary_flip(&buffer, sizeof(buffer));
}
if i use the "binary_flip" code from one of the answers above, it still doesnt fip everything.
What i need to do if flip all the bytes currently held in "buffer" once it is read in using 4096 bytes.
i have been told that by doing "*(unsigned int *)buffer = ~(*(unsigned int*)buffer);" this is only flipping 1 DWORD.... so how do i flip it all?
thanks
Paul.
reading binary data with number of bytes
Short explanation: Since buffer is a pointer (type void*), its size is that of a pointer (at least that''s how i understand it). So its size will be that of a pointer - 4 bytes on a 32 bit machine.
"George W. Bush Geography Simplification Initiative"
More info on George W. Bush
My Homepage (C++ SDL OpenGL Game Programming)
"George W. Bush Geography Simplification Initiative"
More info on George W. Bush
My Homepage (C++ SDL OpenGL Game Programming)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement