groups

name language licence
Force Application Crash Objective-C Other
64-bit Number from a String Perl Other
FourCharCode to NSString Objective-C Other
Printing Binary Representation of String C Other
ROT13 Objective-C Other
NSIndexSet to String Objective-C Other
getBoundingClientRect from WebKit using JavaScriptCore Objective-C Other
NSImage Create QuickLook icon for URL Objective-C Other

< 1 2 3 4 >



language: C
licence: Other

Printing Binary Representation of String

options: view full snippetsend to code collector
// http://forums.devshed.com/showpost.php?p=2150495&postcount=10
#include <stdio.h>

void binaryOut (char c)
{
    unsigned char mask = 0x80; // 10000000 binary
    while (mask)
    {
        if (c & mask) putchar ('1');
        else putchar ('0');
        mask >>= 1;
    }
}

int main (int argc, char* argv [])
	
(Continues...)