Old-fashioned Style (ASCII) & Console Applications

Sep 30 2003 12:59 PM
Hello, I'm writting (or trying to) a Console Application in C#. I has to be console. I remember back in the old days of Cobol (Unisys), Clipper and even Basic, I used to use a program (its name i cannot recall now...) where I designed the "screen" using this "program" and then saved it into an ASCII file. (thus, using 'extended' ASCII's like Lines, Corners, etc. and making screens look nicer and more professional). Then reading a stream of bytes you "read" the screen and "rendered" (write) it back to the screen. Nothing compared with the DOOM3 upcoming engine but... In unisys i could also bind with codes the fields and it's possitions... bla bla bla... i've explained it all because i would like to make sure you understand what is happening to me. For this console app i'm designing, i'd love to use either that technique (which proved to be very simple and useful back in 1990) or something new (which i don't know). I've found a nice class which uses some api calls and allows me to easyly change the screen color and cursor position and clear screen and all the simple utilities you'd love to have for a console app. But i'd love to be able to use my technique (unless someone could point me to something better?) to draw the screens, cuz i'd hate to harcode all the stuff. The problem I'm experiencing is... back in 199x I used ASCII Extended(which doesn't exist really), but those 128+ ascii codes does not correspond with their unicode counterparts (as the 1st 128 do). Then if I use an ASCII drawing program (do you remember TheDraw! for example?) and save a small box in ASCII, when I later read the stream in C# the output is crap... I use this code: FileStream aFile = new FileStream("test.asc",FileMode.Open); StreamReader sw = new StreamReader(aFile,System.Text.Encoding.ASCII); string line; line = sw.ReadToEnd(); Console.Write(line); sw.Close(); Clearly the output is a typical "extendedASCII" opened with notepad... The thing is, there is no such Encoding.extASCII... what can I do? What do you suggest? Is there such thing as TheDrawForUnicode? so i'd save my "screens" as .unicode and use the default encoder for a StreamReader...? I'm confused and old fashioned... Ideas? Comments? Help? Everything will be appreciated. thanks in advance, and kind regards! Martín Marconcini

Answers (14)