Pascal J. Bourguignon wrote:
> Allen <> writes:
>
>> I use bitset to save bits of flag. When data is ready, I need to copy
>> bit values from it to byte buffer. How to do it?
>
> Yes, how? How do you want to represent your bits as a string of
> characters?
>
>
>> Example.
>>
>> #include <bitset>
>> int main()
>> {
>> char buffer[32];
>> std::bitset<256> fcbits;
>> fcbits.set(1);
>> fcbits.set(54);
>> // fcbits -> buffer?
>> }
>
>
> There's not enough bytes in your buffer.
That sounds very definite. How did you tell?
> Surprized? That may be because you don't give a specification precise
> enough.
In that case, I think, all one could say is that for _some_ specifications,
there are not enough bytes in the buffer. For _some_ other specifications,
there are.
> Otherwise, why don't you read the reference to the bitset class?
> http://www.cplusplus.com/reference/stl/bitset/
Or the standard. Now, what particularly is it that the OP should pay
attention to? After all, RTFM is most often not a good answer in a news
group where everything that couldn't be answered that way is off-topic
Best
Kai-Uwe Bux