colorize
colorize copied to clipboard
Compatibility with Windows
I built the console application using MinGW and noticed the Colorize screwing output text like when you encounter encoding problems. What can cause this?
In Windows support for colors has to be explicitly enabled. I added a function to the demo which did the trick in a project where I used this, but haven't tried the code out on Windows yet! Let me know if the update works for you.
No luck unfortunately, 'ID' becomes [0;36m'ID'[0;49m in the console window.
Also, GCC on Ubuntu throws warnings during compilation:
colorize.c: In function ‘ut_strbuf_append_intern’:
colorize.c:258:17: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
char *remainder = strdup(str + memLeftInElement);
^
colorize.c:258:35: warning: initialization makes pointer from integer without a cast [enabled by default]
char *remainder = strdup(str + memLeftInElement);
^
colorize.c: In function ‘ut_strbuf_get’:
colorize.c:331:20: warning: assignment makes pointer from integer without a cast [enabled by default]
result = strdup(b->buf);
^