123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #include <stdio.h>
- #include <string.h>
- #include "images.h"
- #include <iconv.h>
- class IConv {
- iconv_t ic;
- public:
- IConv(const char *to, const char *from) : ic(iconv_open(to, from)) {}
- ~IConv() { iconv_close(ic); }
- int convert(char *input, char *output, size_t outbufsize) {
- size_t inbufsize = strlen(input);
- size_t orig_size = outbufsize;
- memset(output, 0, outbufsize);
- return iconv(ic, &input, &inbufsize, &output, &outbufsize);
- }
- };
- IConv converter("UTF-8", "CP437");
- char display_line(char *line) {
- char output[1024];
- int len;
- converter.convert(line, output, sizeof(output));
- printf("%s\n", output);
- }
- int main() {
- int x;
- int size = (sizeof(skull) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(skull[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(skullblink) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(skullblink[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(ghead) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(ghead[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(ghost) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(ghost[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(wolf) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(wolf[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(panther) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(panther[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- size = (sizeof(bat) / sizeof(char *));
- for (x = 0; x < size; x++) {
- display_line(bat[x]);
- }
- fflush(stdout);
- getchar();
- printf("\n\n");
- return 0;
- }
|