lsflib/src/bindump.c
changeset 6 c3dc3eb3b541
child 9 c3fecc82ade6
new file mode 100644
--- /dev/null
+++ b/lsflib/src/bindump.c
@@ -0,0 +1,23 @@
+/*
+ *  $Id: bindump.c 94 2008-04-05 01:27:30Z mbroeker $
+ * $URL: http://localhost/svn/c/lsflib/trunk/src/bindump.c $
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+char *bindump (char *s, int n)
+{
+    int i, j;
+    static char byte[8];
+
+    for (i = 0; i < strlen (s); i++) {
+        for (j = n - 1; j >= 0; j--) {
+            byte[j] = (s[i] >> j) & 1 ? 1 : 0;
+            printf ("%d", byte[j]);
+        }
+        printf ("\n");
+    }
+    return byte;
+}