Original Post
I haven't really programmed for a year. My skills are a bit rusty... How would I copy bit-by-bit in C/C++? memcpy requires a size in bytes, so it cannot work. For example, say I have a 32-bit int, and a byte buffer. int dataArray[10]; char *buffer = new char[8]; I want to copy the least significant 7 bits of each entry in dataArray, and stuff them into buffer contiguously (i.e. no spaces. They should be aligned). How would I do this? I can see a way to do it with STL bitset, but avoiding STL would be nice. Thanks.