Click here to Skip to main content
15,916,600 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to create an application resembling a MS-DOS window in C# (using a rich text box). The problem, however, is that I cannot get my characters displayed correctly when reading a binary file. Is there a way of getting these characters to work with fonts like Lucida Console or Courier New, or do I specifically need a terminal font? I have found a few terminal true type fonts by googling, but none of them support any more characters than the other two above mentioned fonts. My program should be able to display all the characters in code page 437 (although the glyphs need not look exactly the same).
Posted
Comments
Toli Cuturicu 9-Dec-10 16:47pm    
Don't. Just use Unicode like all other people do!

I suspect that your file contains Unicode characters.

If that is so and you know the encoding used to write the file, you can use the BinaryReader(stream, encoding)[^] overridden constructor. Then use the ReadChar()/ReadChars() method to get the characters for display.
 
Share this answer
 
Comments
KyleCF89 9-Dec-10 15:09pm    
Thanks for the quick reply. I doubt it's a Unicode problem, because I don't really care about accurate international format viewability. For example: if you open a MS-DOS window, and type "edit command.com" (under XP), it will open an editor that allows you to view the text with cp437 characters, which were also used for drawing pictures through text in the older DOS days. Similarly, nfo files still use this to draw pictures using the old dos-style text. An example of a viewer that does this perfectly is Damn NFO Viewer, which displayes all these characters correctly.
MS LineDraw Font[^] might be an option for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900