 +  returnValue[pos2] = '\0';
 +  return returnValue;
 +}
- 
+
  int main(int argc, char *argv[]) {
-   
+
 @@ -36,18 +76,31 @@ int main(int argc, char *argv[]) {
       if (pulseLength != 0) mySwitch.setPulseLength(pulseLength);
       mySwitch.enableReceive(PIN);  // Receiver on interrupt 0 => that is pin #2
-      
--    
+
+-
       while(1) {
-   
+
        if (mySwitch.available()) {
-     
+
 -        int value = mySwitch.getReceivedValue();
 +        unsigned long decimal = mySwitch.getReceivedValue();
 +        unsigned int length = mySwitch.getReceivedBitlength();
 +        unsigned int delay = mySwitch.getReceivedDelay();
 +        unsigned int *raw = mySwitch.getReceivedRawdata();
 +        unsigned int protocol = mySwitch.getReceivedProtocol();
-     
+
 -        if (value == 0) {
 +        if (decimal == 0) {
            printf("Unknown encoding\n");
-         } else {    
--   
+         } else {
+-
 -          printf("Received %i\n", mySwitch.getReceivedValue() );
 +          const char* b = dec2binWzerofill(decimal, length);
 +          fprintf(stdout, "Decimal: %u (%i bits)\n", decimal, length);

--- a/RPi_utils/RFSniffer.cpp
+++ b/RPi_utils/RFSniffer.cpp
@@ -15,7 +15,47 @@
      
 RCSwitch mySwitch;
  
+static char *dec2binWzerofill(unsigned long Dec, unsigned int bitLength) {
+  static char bin[64]; 
+  unsigned int i=0;
 
+  while (Dec > 0) {
+    bin[32+i++] = ((Dec & 1) > 0) ? '1' : '0';
+    Dec = Dec >> 1;

+          }
+          fprintf(stdout, "\n");
         }

         mySwitch.resetAvailable();
--
2.10.2

