Revision: 6986
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 29, 2008 16:29 by narkisr
Initial Code
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int decode(unsigned char);
int decode(unsigned char ch) {
ch = ~((ch << 2) | ((ch & 0xC0) >> 6));
if (ch) {
if (isprint(ch)) {
return ch;
} else {
return ' ';
}
}
return '\n';
}
int main(int argc, char *argv[]) {
int ch;
FILE *fp;
if (argc < 2) {
fp = stdin;
} else {
if (NULL == (fp = fopen(argv[1], "r"))) {
fprintf(stderr, "Error: Cannot open file %s\n", argv[1]);
exit(EXIT_FAILURE);
}
}
while (EOF != (ch =fgetc(fp))) {
fputc(decode(ch), stdout);
}
return EXIT_SUCCESS;
}
Initial URL
Initial Description
Initial Title
Linksys backup format to text convertor
Initial Tags
c
Initial Language
C++