Posts

Program that generates brainfuck code that outputs given text

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0; } 5 $begingroup$ I created program that generates brainfuck code that outputs given text. Arguments for the program are input file with the text and output file where code will be generated to. Here is the code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define ALLOCATION_ERROR 1 #define FILE_ERROR 2 #define OTHER_ERROR 3 static inline FILE* get_file_pointer(const char* filename,const char* mode){ FILE* file_pointer=fopen(filename,mode); if(file_pointer==NULL){ fprintf(stderr,"Error: failed to open file %sn",filename); exit(FILE_ERROR); } return file_pointer; } stat...