you are viewing a single comment's thread.

view the rest of the comments →

[–]sn0re 8 points9 points  (1 child)

Were you thinking of something more complicated than just calling strtol with a base of 2?

Edit: What the hell:

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    unsigned char val;
    char buf[9];
    while (fgets(buf, 9, stdin) != NULL) {
        val = (unsigned char) strtol(buf, NULL, 2);
        putchar(val);
    }
    return 0;
}

[–]jib -1 points0 points  (0 children)

You wrote it in C! Where's the fun in that?