Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Plz help me with the characters showing.

Reply
Thread Tools

Plz help me with the characters showing.

 
 
pinkfog
Guest
Posts: n/a
 
      04-12-2006
hi,all
I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
ranging from 0-255.
snippet:
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
int main(int argc, char* argv[])
{
int i = 0;
for(i = 0; i < 255; i++)
{
printf("%d = %c\n", i, i);
}
getch();
return 0;
}


IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
what's the problem?
Any one can help?
Thx.
-----------------pinkfog---------------

 
Reply With Quote
 
 
 
 
Vladimir S. Oka
Guest
Posts: n/a
 
      04-12-2006
pinkfog opined:

> hi,all
> I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
> ranging from 0-255.
> snippet:
> #include "stdafx.h"


Don't know what this is (it's not Standard C), but you don't need it
anyway.

> #include "stdio.h"


#include <stdio.h>

> #include "conio.h"


Not Standard C. Probably don't need this either.

> int main(int argc, char* argv[])
> {
> int i = 0;


Superfluous inititalisation, as you initialise it below.

> for(i = 0; i < 255; i++)
> {
> printf("%d = %c\n", i, i);
> }
> getch();


This is non-standard (comes from "conio.h"). What's wrong with the
standard `getchar()`?

> return 0;
> }
>
>
> IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
> what's the problem?


ASCII characters are only the ones with codes 0-127. The other problem
is in the setup of your console. Obviously it does not know how to
display all the codes (or you think they should display differently).
Not a C issue, so you may want to ask elsewhere.

--
"The IETF motto is 'rough consensus and running code'"

-- Scott Bradner (Open Sources, 1999 O'Reilly and Associates)

<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      04-12-2006
pinkfog wrote:
> hi,all
> I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
> ranging from 0-255.
> snippet:


> #include "stdafx.h"

What's this header for?

> #include "stdio.h"


prefer #include <stdio.h>

> #include "conio.h"

What's this header for?

> int main(int argc, char* argv[])
> {
> int i = 0;
> for(i = 0; i < 255; i++)
> {
> printf("%d = %c\n", i, i);
> }
> getch();

Why?

> return 0;
> }
>
>
> IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
> what's the problem?
> Any one can help?


Your locale's character set does not include these characters.

--
Ian Collins.
 
Reply With Quote
 
jefong@56.com
Guest
Posts: n/a
 
      04-12-2006
the ASCII character is only rangin from 0-127.

 
Reply With Quote
 
jefong@56.com
Guest
Posts: n/a
 
      04-12-2006
charactor is only ranging from 0-127

 
Reply With Quote
 
slebetman@yahoo.com
Guest
Posts: n/a
 
      04-12-2006
pinkfog wrote:
> hi,all
> I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
> ranging from 0-255.
> snippet:
> #include "stdafx.h"
> #include "stdio.h"
> #include "conio.h"
> int main(int argc, char* argv[])
> {
> int i = 0;
> for(i = 0; i < 255; i++)
> {
> printf("%d = %c\n", i, i);
> }
> getch();
> return 0;
> }
>
>
> IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
> what's the problem?
> Any one can help?
> Thx.
> -----------------pinkfog---------------


Well... my favourite text editor already does what your program do and
does it live while I'm editing code. On top of that it also
*highlights* the relevant line when the cursor is on either the opening
or closing brace {}. On top of that it does syntax highlighting. On top
of that it also allows me to fold sections of code to temporarily hide
things I'm not interested in (and remember this is "live" while I'm
editing). And to top it all off it can print, save as RTF save as PDF
and save as HTML the nicely formatted code along with the nice lines.
The only difference is that my editor draws lines based on indentation
while your program auto-indent and draws lines based on braces. But
that's OK, that's what "indent" is for. Oh and yes my editor supports
syntax of more than 40 different languages.

 
Reply With Quote
 
slebetman@yahoo.com
Guest
Posts: n/a
 
      04-12-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Well... my favourite text editor already does what your program do and
> does it live while I'm editing code. On top of that it also
> *highlights* the relevant line when the cursor is on either the opening
> or closing brace {}. On top of that it does syntax highlighting. On top
> of that it also allows me to fold sections of code to temporarily hide
> things I'm not interested in (and remember this is "live" while I'm
> editing). And to top it all off it can print, save as RTF save as PDF
> and save as HTML the nicely formatted code along with the nice lines.
> The only difference is that my editor draws lines based on indentation
> while your program auto-indent and draws lines based on braces. But
> that's OK, that's what "indent" is for. Oh and yes my editor supports
> syntax of more than 40 different languages.


Oh crap posted on the wrong thread. Ignore this, sorry... very, very
sorry.

 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      04-12-2006
"pinkfog" wrote:

> I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
> ranging from 0-255.
> snippet:
> #include "stdafx.h"
> #include "stdio.h"
> #include "conio.h"
> int main(int argc, char* argv[])
> {
> int i = 0;
> for(i = 0; i < 255; i++)
> {
> printf("%d = %c\n", i, i);
> }
> getch();
> return 0;
> }
>
>
> IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
> what's the problem?


The problem is with VC 6.0. The essential core of your program does what
you want in DevC (MingW). It shows the old MS-DOS era glyphs for 128 to
255. Try posting your question where VC is topical. I have it on my
machine but I never used it and don't want to use it.


 
Reply With Quote
 
Richard G. Riley
Guest
Posts: n/a
 
      04-12-2006
On 2006-04-12, pinkfog <(E-Mail Removed)> wrote:
> hi,all
> I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
> ranging from 0-255.
> snippet:
> #include "stdafx.h"
> #include "stdio.h"
> #include "conio.h"
> int main(int argc, char* argv[])
> {
> int i = 0;
> for(i = 0; i < 255; i++)
> {
> printf("%d = %c\n", i, i);
> }
> getch();
> return 0;
> }
>
>
> IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
> what's the problem?
> Any one can help?
> Thx.
> -----------------pinkfog---------------
>


Look up "locale" and how character sets work. The characters > 127 can
be all sorts of wierd and wonderful things and will depend on the
platform, location, window, locale setting and installed fonts.

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      04-12-2006
(E-Mail Removed) wrote:

> charactor is only ranging from 0-127


See below.



Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
plz help me in C/C++ Logic plz mrkanuganti@gmail.com C++ 2 11-24-2006 11:33 AM
plz help C/C++ Logic plz mrkanuganti@gmail.com C++ 1 11-24-2006 11:05 AM
plz help me in C/C++ Logic plz mrkanuganti@gmail.com C++ 1 11-24-2006 10:23 AM
Re: plz help!!! plz plz plz plzplzplz help the noob alkzy Microsoft Certification 0 10-31-2004 10:04 PM
Computer Problems... Plz Plz Plz HELP ME..... Nick Computer Support 0 06-04-2004 08:50 PM



Advertisments