Re: formatted printing of text- color



"babo" <moron68@xxxxxxxxxxx> wrote in news:1133304747.771614.207220
@g44g2000cwa.googlegroups.com:

> #include <stdio.h>
> #include <conio.h>
>
> int main () {
> char i;
>
> for (i=0;i<=102;i++)
> {
> printf ("\n%2c %4d",i,i);
> }
> getch ();
> }
> //this will print You a ascii hearts and spikes in the begining???and
> then the letters
>
> //ofcourse in c language ...
>

This is because the first 32 ASCII characters are non-printing characters
such as tab, newline, backspace, escape, ... How these are represented
depends greatly on the implementation, the platform, and the platform's
settings. Try running this same C program before and after setting the
KEYB setting on DOS systems (I don't know if it still works on 32 bit
windows systems). You will get very different results.

You can see the complete ASCII table at http://www.asciitable.com/ Compare
the output from your code above to the table, and you will see that the
first 32 characters come out differently, but after that it should be the
same.

The bottom line is, you can't do what you want in ASCII code. Unicode
might help, but you're still not going to get the colours you mentioned in
your first post.

Why do you want this in the console window anyway? If you want something
that looks nice, you really need a GUI.

--
Beware the False Authority Syndrome
.



Relevant Pages

  • Re: File-Compare "fc" falsely reports mismatch between identical files
    ... first and last lines of each set of differences, whereas /L is said to compare files as ascii text. ... Show me a couple of "text files" that fc/a does not compare properly, and I would argue that they are so extreme in some way that I would not consider them "text files". ... One of the definitions found by google is this: "A file that contains characters organized into one or more lines. ... the tax department reacted to a customer's complaint and insisted that the faulty tax calculation be fixed. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: POS. Cash Register on AS400.- New and Updates
    ... Probably the easiest way would be to send them as ASCII. ... You need to change the printer file to not convert unprintable characters. ... "The INITPRT tag defines the ASCII control ... but still can not open cash drawer. ...
    (comp.sys.ibm.as400.misc)
  • Re: Unicode Support
    ... consider:)...but, you know, a file is still just a "stream of characters" ... "escape sequence" but accessing an ordinary ASCII character) are considered ... English, while all your identifiers are in "Romanji" Japanese or something ... NASM appears already to do so with strings and comments in ...
    (alt.lang.asm)
  • Re: System 360 EBCDIC vs. ASCII
    ... I suppose they could have created a 7-bit architecture if it ... There are a few vestiges of 7-bit characters in other computer systems due ... If you set your modem to 8 bits you ... connections, including hardwired ones: plotters, ASCII terminals, etc. ...
    (bit.listserv.ibm-main)
  • Re: File-Compare "fc" falsely reports mismatch between identical files
    ... compare files as ascii text. ... to two different printers and produced different results. ... the definitions found by google is this: "A file that contains characters ... calculated tax payable - for a period of six years. ...
    (microsoft.public.win2000.cmdprompt.admin)