473,382 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Plz help me with the characters showing.

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---------------

Apr 12 '06 #1
15 1829
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>

Apr 12 '06 #2
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.
Apr 12 '06 #3
the ASCII character is only rangin from 0-127.

Apr 12 '06 #4
charactor is only ranging from 0-127

Apr 12 '06 #5
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.

Apr 12 '06 #6
sl*******@yahoo.com 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.

Apr 12 '06 #7
"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.
Apr 12 '06 #8
On 2006-04-12, pinkfog <ch*******@gmail.com> 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.

Apr 12 '06 #9
je****@56.com 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.
Apr 12 '06 #10
pinkfog wrote:
hi,all
I write a snippet(in VC6.0 PLATFORM) to show the ASCII character
ranging from 0-255.
There is no such thing. The ASCII character set is defined over 0-127.
snippet:
#include "stdafx.h" Not a standard header. Remove.
#include "stdio.h" Unless you have your own personal copy of stdio.h that you intend to
use, this is not the right way to include a standard header, Use
#include <stdio.h>
#include "conio.h" Not a standard header. Remonve
int main(int argc, char* argv[])
{
int i = 0;
for(i = 0; i < 255; i++)
{
printf("%d = %c\n", i, i);
}
getch(); Not a standard function. Remove or replace with a standard
function or macro. One such is getchar().
return 0;
}
IT can normaly show 0-127,but cannot show 128-255 just like "219=?".
what's the problem?
You implementation seems use the ASCII characters set and know that
it is defined only over the range of 0-127.
Any one can help?
Perhaps you should start by learning standard C. Then learn that your
code does not necessarily relate to ASCII at all; other encodings are
possible. In fact, you seem to want some other encoding, since you want
to display characters for values which are outside the defined range of
ASCII.
Thx.


Would it really have hurt your hand to type *two* more characters? Like
this:
Thanks
Apr 12 '06 #11
Martin Ambuhl opined:
pinkfog wrote:
Thx.


Would it really have hurt your hand to type *two* more characters?
Like this:
Thanks


It may have, as it's four more, *and* that "x" needs translating.

--
"...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and
the Ugly)."
(By Matt Welsh)

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

Apr 12 '06 #12
Vladimir S. Oka wrote:
Martin Ambuhl opined:

pinkfog wrote:

Thx.


Would it really have hurt your hand to type *two* more characters?
Like this:
Thanks

It may have, as it's four more, *and* that "x" needs translating.


The string "Thx." has 4 characters.
The string "Thanks" has 6 characters.
In your arithmetic the value of 6-4 may be 4, but don't bother applying
for work anywhere that uses numbers.
Idiot.
Apr 12 '06 #13
Martin Ambuhl opined:

You didn't strike me as the one to not get the joke...
Vladimir S. Oka wrote:
Martin Ambuhl opined:

pinkfog wrote:
Thx.

Would it really have hurt your hand to type *two* more characters?
Like this:
Thanks

It may have, as it's four more, *and* that "x" needs translating.


The string "Thx." has 4 characters.


I do admit not counting a ".".
The string "Thanks" has 6 characters.
In your arithmetic the value of 6-4 may be 4, but don't bother
applying for work anywhere that uses numbers.
Now, still not counting the ".":

"Thx" differs from "Thanks" in 4 characters ("anks"), possibly 5 if you
count the "x" (that needs translating into "anks"). So, it does
require typing 4 extra characters ("anks"), and, if you want to be
very precise, one less ("x"), in which case we're both wrong, as it's
3, not 2 or 4.
Idiot.


And that was totally uncalled for.

Goodbye.

--
Either one of us, by himself, is expendable. Both of us are not.
-- Kirk, "The Devil in the Dark", stardate 3196.1

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

Apr 12 '06 #14
On Wed, 12 Apr 2006 17:37:45 +0200, "Richard G. Riley"
<rg****@gmail.com> wrote in comp.lang.c:
On 2006-04-12, pinkfog <ch*******@gmail.com> 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.


There are NO characters > 127 in Microsoft Visual C++ 6.0. The type
"char" is signed, and ranges from -128 to 127.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Apr 13 '06 #15
Jack Klein wrote:

<snip>
There are NO characters > 127 in Microsoft Visual C++ 6.0. The type
"char" is signed, and ranges from -128 to 127.


<OT>
Unless you set the option to tell it to make char unsigned.
</OT>
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Apr 13 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP,...
2
by: lkrubner | last post by:
What I need to do is find out what characters in a string are not supported by the UTF-8 encoding. The problem arises when someone logs in and uses my php script to create a weblog post. They are...
1
by: Walt | last post by:
We are using ASP.net to develop a new website. The old website uses legacy ASP connecting to an Oracle database (9.2, W2k3, charecter set WE8ISO8859P1). The new site connects to the same database...
3
by: thomasamillergoogle | last post by:
I am building a web page to show a TCP/IP raw packet. I need to show "special characters" on the web page I am working on. When I say "special characters" i am talking about tabs, whitespace,...
2
by: jaekim | last post by:
Visual .NET c# design view is showing "?????" for all the Korean characters in design view. In code view, it looks okay. Did anybody have this kind of problem with foreign characters?
1
by: prasadoo | last post by:
Hi everyone, I am trying to populate DropDownList with French characters but for some characters like é,d' etc.it is not showing the exacts French characters. Can anybody help me how to populate...
1
by: Peter K | last post by:
Hi I am writing an application where I need to process some text read from files, and write information to a content-management-system. Unfortunately the CMS does not accept international...
3
by: ConfusedMay | last post by:
Hi, I have an access 97 database that need to be upgraded to 2003. The problem is now on the 2003, the description field in all of my reports are showing up in Chinese characters instead of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.