[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Rai Hardeep S.
23 Nov 2004 12:02:37 GMT
On Sun, 21 Nov 2004 15:16:41 +0100, Ulrich Eckhardt <email@example.com> wrote:
> Rai Hardeep S. wrote:
>> Is there any equivalent to setbase(2), i.e to take output in binary
>> form. As such setbase() can accept 8, 10 and 16 argument.
> Not GCC specific, but there are (IIRC) overloaded inserters/extractors in
Thank you Ulrich Eckha for your code. I know one can write easily
function to achieve the objective.
If I unserstood correctly, the bitset will be something like array
which may store only 0 and 1, and not for directly writing values in
>> I wish to take output in binary form.
> I hope you mean that you want numbers to be formatted as sequences of '0'
> and '1' characters, and not some kind of binary as opposed to textual.
Yes, you are right.
Infact, I wonder, why such function is not available in C++,
setbase() function may be made to accept 2 in addition to 8, 10 and
16, or even any other base valve.
Is there any specific reason, not to include base 2 in above
function, and not to provide any othere function for this need.
H. S. Rai,