|
@@ -1,12 +1,91 @@
|
|
|
#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 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");
|
|
|
|
|
|
- for( x = 0; x < sizeof(skull); x++ ) {
|
|
|
- printf("%s\n", skull[x] );
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
+ return 0;
|
|
|
+}
|