Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: Pixel_Outlaw on June 13, 2011
-
I currently have the need to output some unicode characters into the console window.
I wish to output some braille characters like shown here...
http://tlt.its.psu.edu/suggestions/international/bylanguage/braillechart.html
These will be dithering patterns in a crude image to text program.
Please help if you can.
-
Like this (http://blog.kalmbachnet.de/?postid=98) ?
-
I'm using GCC\Linux and it looks like that code may not be compatible.
Resulting debug:
C:\Users\ryan\Desktop\blarg_test\main.cpp||In function 'int main()':|
C:\Users\ryan\Desktop\blarg_test\main.cpp|8|error: 'WCHAR' was not declared in this scope|
C:\Users\ryan\Desktop\blarg_test\main.cpp|8|error: expected ';' before 'c'|
C:\Users\ryan\Desktop\blarg_test\main.cpp|9|error: 'c' was not declared in this scope|
||=== Build finished: 3 errors, 0 warnings ===|
-
Correct, that code is for Microsoft C runtime only.
-
#include <stdio.h>
int main(void)
{
printf("%lc", 0x280F);
return 0;
}
Does this work?
Jim
-
Oddly enough I dont see any character printed from that code Jim.
I'm fairly sure Debian supports Unicode in the terminal but I see nothing printed out. It does not have any errors or exceptions when debugging either. ???
I did try a few things before posting here but still came up empty handed.
-
Yes, your terminal probably supports unicode via utf-8 encoding, but the question is if your C runtime can spit them out properly.
How about:
printf("\x28\x0F");
or
printf("\x0F\x28");
Jim
-
That time I got something Jim.
The character ( was printed for both calls.
I did one character then called printf with the other.
You can see the output "((" then my command prompt returned.
#include <stdio.h>
int main(void)
{
printf("\x28\x0F");
printf("\x0F\x28");
return 0;
}
-
Hmm I can output a block character from unicode directly with my compiler:
cout << "▒" << endl;
However I have a feeling that this is not portable nor standard usage...
-
Does this help?
http://mielke.cc/pipermail/brltty/2008-January/003239.html (http://mielke.cc/pipermail/brltty/2008-January/003239.html)
Jim
-
Jim, thanks for the information. Looks like I am running the correct kernel version. (2.6.32)
I've decided to just use standard cout calls with the braille character plopped directly into the editor.
I won't worry about a Windows port of my image viewer simply because most of the time Windows users use only the GUI.