Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define P(C,X)case C:printf(#X);break; /* bftoc.c by markvipixar.com */
- int main(int argc, char *argv[])
- {
- int c;
- FILE *input;
- char inbyte;
- int tabs=0;
- int d=0;
- if ( ( input=fopen(argv[1],"r") ) == NULL ) exit(-1);
- printf ("main(){\n\tchar *p;\n\tp=malloc(9999);\n");
- while (!feof(input))
- {
- fread(&inbyte,1,1,input);
- c=inbyte;
- if ( c == 91 )
- tabs++;
- else if ( c == 93 )
- tabs--;
- for (d=0; d < tabs; d++)
- printf("\t");
- switch(c)
- {
- P(62, \t*(p)++;\n);
- P(60, \t*(p)--;\n);
- P(43, \t++*(p);\n);
- P(45, \t--*(p);\n);
- P(46, \tputchar(*p);\n);
- P(44, \t*p=getchar();\n);
- P(91, while (*p){\n);
- P(93, \t}\n);
- }
- }
- printf("\texit(0);\n}\n");
- fclose(input);
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement