howto display raw chars on console? 
Author Message
 howto display raw chars on console?

I can't figure out the proper format to display raw console chars.  The
following C code displays a simple ascii chart:

int main(int argc,char **argv)    // ascii chart in c
{
puts("dec hex char");
for(int i=0; i<256; i++)
  printf("%03d %02x %c\n",i,i,i);

Quote:
}

How do I do the same using C#? The following formats {2} as decimal, like
{0} but there's no ':D'

using System;                // ascii chart in c#, {2}displays like {0}(bug)
namespace ascii.NET
{
        class Class1
        {
                static void Main(string[] args)
                {
                        for (int i=0; i<256; i++)
                        {
                        Console.WriteLine("{0:D3} {1:X2} {2}",i,i,i);
                        }
                }
        }

Quote:
}

Does anyone know the proper formatting magic to display raw characters on
the console using the CLR?

-Frank Brown
http://www.*-*-*.com/ ~frog/



Sun, 21 Mar 2004 08:10:16 GMT  
 howto display raw chars on console?
How about:

System.Int32 i;
for ( i=0; i<256; i++)
  Console.WriteLine( (char)i );

yhhuang
ICQ:91074870



Sun, 21 Mar 2004 13:06:19 GMT  
 howto display raw chars on console?
Thanks...I was hoping it was something simple like this!
-Frank


Quote:
> How about:

> System.Int32 i;
> for ( i=0; i<256; i++)
>   Console.WriteLine( (char)i );



Sun, 21 Mar 2004 22:51:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Console Project :: Displayed Char Size ?

2. Raw input in console app

3. Displaying a RAW Image

4. Displaying Raw/PGM image??

5. Importing a 4-bitplane raw image and displaying it

6. datagrid / boundcolumn displaying raw xml

7. HOWTO: Clear Screen in a Console App?

8. Howto make console invisible ?

9. Newbie: Howto convert char variable __gc into CString?

10. Howto pass array of char as input for method

11. HOWTO : Insert a property which handles embedded NULL chars in an ACTIVEX generated with VC++ 6.0

12. HowTo?: assigning a char or string with a \u Unicode escape sequence or 0x Hex code

 

 
Powered by phpBB® Forum Software