I have come up to a point in C++ where I need a custom character. I'll try to explain what I mean to say: As you guys already know the characters in text mode are the patterns of dots, like the 'A' being as:
0000001000000
0000010100000
0000100010000
0001000001000
0001000001000
0001111111000
0001000001000
0001000001000
0001000001000
...where the 1's represent the active dot and 0's inactive. I want to know how do I create such a character by myself this way. I have been told that there is a way (without going through a huge mess), but I haven't been thorough开发者_如何学Pythonly guided. I hope I'll get help here. thanks.
Assuming you're targeting DOS in text mode - read up on interrupt 10h, AH 11h. It lets you load user-defined characters into the character generator memory. See here: http://webpages.charter.net/danrollins/techhelp/0151.HTM
I don't think Turbo C has a wrapper function for that particual call. For invoking interrupts directly, use the int86() function.
This is dealing with the video adapter text mode memory, BIOS int 10h calls, etc. So 1990's... Most modern operating systems don't work in text mode, and use TrueType fonts (even for "console" applications that emulate text mode).
If you want a double horizontal line character that takes the whole block, so that a line runs uninterrupted, the pseudographic character 0xCD (═) might help.
It depends on the current codepage, but most national codepages (including the Cyrillic 866) leave the pseudographic characters intact.
Just output a row of 0xCDs, see how it looks.
for(i=0;i<20;i++)
putchar(0xcd);
精彩评论