[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppBuilderIntToBitString
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppBuilderIntToBitString
(C++ Builder) Converting an integer to a String of bits
Use the technique called bitshifting. More info at that page.
String intToBitString(int integer)
{
String myBitString;
while (integer > 0)
{
if (integer%2==0)
myBitString = "0" + myBitString;
else
myBitString = "1" + myBitString;
integer>>=1;
}
return myBitString;
}
Topic links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
