473,320 Members | 1,828 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,320 software developers and data experts.

ASCII characters

jt
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???
Sep 5 '08 #1
14 3580

"jt" <ka**********@gmail.comwrote in message
news:22**********************************@i20g2000 prf.googlegroups.com...
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???
They're called non-printable for a reason.

What did you expect to see?

--
Bartc

Sep 5 '08 #2
jt wrote:
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???
You're not able to print the non-printable?
Hmm ...

--
pete
Sep 5 '08 #3
jt


Bartc wrote:
"jt" <ka**********@gmail.comwrote in message
news:22**********************************@i20g2000 prf.googlegroups.com...
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???

They're called non-printable for a reason.

What did you expect to see?

--
Bartc


when i execute the same statement in windows a smiley will be
outputted.
Sep 5 '08 #4
jt wrote:
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....
Well, presumably it's called a non-printable character because it
doesn't have a printing representation.

What do you want to see if it's non-printable? Use `isprint` to
find out if its printable or not, then decide how you want to
display a non-printing character.

#include <ctype.h>

void printCharSomehow( unsigned char ch )
{
printf( (isprint( ch ) ? "'%c'" : "char(%d)"), ch );
}

--
'It changed the future .. and it changed us.' /Babylon 5/

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Sep 5 '08 #5
jt
On Sep 5, 5:26*pm, Chris Dollin <chris.dol...@hp.comwrote:
jt wrote:
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

Well, presumably it's called a non-printable character because it
doesn't have a printing representation.

What do you want to see if it's non-printable? Use `isprint` to
find out if its printable or not, then decide how you want to
display a non-printing character.

* * #include <ctype.h>

* * void printCharSomehow( unsigned char ch )
* * * * {
* * * * printf( (isprint( ch ) ? "'%c'" : "char(%d)"), ch );
* * * * }

--
'It changed the future .. and it changed us.' * * * * * * */Babylon 5/

Hewlett-Packard Limited * * Cain Road, Bracknell, * * * * ** * *registered no:
registered office: * * * * *Berks RG12 1HN * * * * * * * * * * * 690597 England
please check the below link..i want to print those symbols..
http://didgood.com/programing/datath...scii-0-127.gif
Sep 5 '08 #6
On September 5, 2008 08:07, in comp.lang.c, jt (ka**********@gmail.com)
wrote:
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???
What part of "non-printable" do you not understand?

For what it's worth, ASCII is divided into three types of character:
1) printable characters, including the SPACE character
2) format effectors, like CARRIAGE RETURN, LINE FEED, FORM FEED, and TAB,
3) communications effectors, like START OF HEADER, START OF TEXT, and END
OF TEXT (all used in BSC/Bisync communications protocols), ESCAPE,
SHIFT IN, and SHIFT OUT (used to select alternate glyphs), DELETE,
SUBSTITUTE (used in data correction and recovery)

(Note: these are my terms for these characters. For the official terms,
please see either the ANSI "US-ASCII" standards, or the CCITT "7 bit
characterset" standards. These two standards are interchangable, and both
describe the characterset coloqually known as "ASCII".)

For the printable characters (0x20 through 0x7e), printf() should result in
a glyph being deposited onto the display media. For the "format effectors",
printf() should not "deposit a glyph", but should instead change the
position of the /next/ glyph according to the effector. And, finally, for
the "communications effectors", printf() should (for the most part) show
neither a glyph, nor reposition for the next glyph. (In fact, the display
behaviour will be implementation-defined, and outside the scope of C to
define or influence).
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Sep 5 '08 #7
On September 5, 2008 08:20, in comp.lang.c, jt (ka**********@gmail.com)
wrote:
>

Bartc wrote:
>"jt" <ka**********@gmail.comwrote in message
news:22**********************************@i20g200 0prf.googlegroups.com...
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???

They're called non-printable for a reason.

What did you expect to see?

--
Bartc

when i execute the same statement in windows a smiley will be
outputted.
Which goes to show how much Microsoft follows standards. :-)

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Sep 5 '08 #8
"jt" <ka**********@gmail.comwrote in message
news:60**********************************@r15g2000 prd.googlegroups.com...
>

Bartc wrote:
>"jt" <ka**********@gmail.comwrote in message
news:22**********************************@i20g200 0prf.googlegroups.com...
hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???

They're called non-printable for a reason.

What did you expect to see?

--
Bartc

when i execute the same statement in windows a smiley will be
outputted.
Character 1 was originally SOH control code. Windows text console will show
it as a smiley (as you've seen). Windows graphics will just show a blank.
It's anyone's guess what Linux will show. So use of these characters is
rather hit and miss.

You need to use unicode for this. I think 0x263A. Then figure out how to
show unicode using C+Linux. Or you could just use :-) :-)

--
Bartc

Sep 5 '08 #9
On September 5, 2008 08:49, in comp.lang.c, Bartc (bc@freeuk.com) wrote:
"jt" <ka**********@gmail.comwrote in message
news:60**********************************@r15g2000 prd.googlegroups.com...
>>

Bartc wrote:
>>"jt" <ka**********@gmail.comwrote in message
news:22**********************************@i20g2000 prf.googlegroups.com...
>hello everyone..,
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....
[snip]
>when i execute the same statement in windows a smiley will be
outputted.

Character 1 was originally SOH control code.
Which is the Bisync/BSC communications protocol "Start of Header" octet,
used to delimit the beginning of the BSC address (as opposed to the
beginning or ending of the data) in a bisync communications exchange. Since
ASCII was defined, SOH has been given other uses.
Windows text console will
show it as a smiley (as you've seen). Windows graphics will just show a
blank. It's anyone's guess what Linux will show. So use of these
characters is rather hit and miss.
For the most part, it is up to each execution environment to interpret these
characters by their own standards. Output 0x01 to a serial line connected
to a BSC/RJE device, and that device will expect a bisync address and data
frame to follow. Output to a Windows text console, and Windows will display
a glyph which is not part of the ASCII standard glyphs. To each his own ;-)
You need to use unicode for this. I think 0x263A. Then figure out how to
show unicode using C+Linux. Or you could just use :-) :-)
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Sep 5 '08 #10
"jt" wrote:
>please check the below link..i want to print those symbols..
http://didgood.com/programing/datath...scii-0-127.gif
I suggest a search term such as this in a google search:
linux dos glyph
That should get you started.

I think there is a typo in your refernce page. Character 096 should show
the glyph for the grave chacracter.

Trivia. Doing a similar thing on the Atari ST can produce a picture that
looks remarkably like Hugh Hefner smoking a pipe. A young Hugh Hefner. And
there is a glyph pair somewhere that can produce an integral sign, as in
integral calculus.
Sep 5 '08 #11
jt <ka**********@gmail.comwrites:
i'm using ubuntu 8.04 OS. I'm not able to output the non-printable
ascii chatacters.
for eg.
printf("%c",1); // nothing is outputted.....

is there any way to output these characters...???
You already did; it just didn't display the way you expected it to.

<OT>
Your system provides ways to see your program's output in printable form.
For example, try "./my_program | cat -A" or "./my_program | od -c".
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 5 '08 #12
"osmium" <r1********@comcast.netwrites:
[...]
Trivia. Doing a similar thing on the Atari ST can produce a picture that
looks remarkably like Hugh Hefner smoking a pipe. A young Hugh Hefner.
[...]

<WAY_OT>
I believe that's J.R. "Bob" Dobbs.
<http://en.wikipedia.org/wiki/J.R._Bob_Dobbs>
</WAY_OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 5 '08 #13
Keith Thompson wrote:
"osmium" <r1********@comcast.netwrites:
[...]
Trivia. Doing a similar thing on the Atari ST can produce a
picture that looks remarkably like Hugh Hefner smoking a pipe. A
young Hugh Hefner.
[...]

<WAY_OT>
I believe that's J.R. "Bob" Dobbs.
<http://en.wikipedia.org/wiki/J.R._Bob_Dobbs>
</WAY_OT>
I have that picture (suitably magnified) on the door of my mini-fridge
in my cubicle. Bob watches over me. As long as he's still grinning, I
figure I must be ok.


Brian
Sep 5 '08 #14
"Default User" <de***********@yahoo.comwrote:
Keith Thompson wrote:
"osmium" <r1********@comcast.netwrites:
Trivia. Doing a similar thing on the Atari ST can produce a
picture that looks remarkably like Hugh Hefner smoking a pipe. A
young Hugh Hefner.
<WAY_OT>
I believe that's J.R. "Bob" Dobbs.
<http://en.wikipedia.org/wiki/J.R._Bob_Dobbs>
</WAY_OT>

I have that picture (suitably magnified) on the door of my mini-fridge
in my cubicle. Bob watches over me. As long as he's still grinning, I
figure I must be ok.
That's what you think. That's what They want you to think. But ponder
this... is he grinning _with_ you, or _about_ you?

Trust nobody, not even (nay, especially) those who seem trustworthy.
Hail Eris.

Richard
Sep 8 '08 #15

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

Similar topics

37
by: chandy | last post by:
Hi, I have an Html document that declares that it uses the utf-8 character set. As this document is editable via a web interface I need to make sure than high-ascii characters that may be...
4
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
6
by: Friso Wiskerke | last post by:
Hi all, I'm creating a fixed length textfile with data which is sent out to a third-party which in turn reads the file and processes it. Some of the characters are not part of the lower ASCII...
18
by: John | last post by:
Hi, I'm a beginner is using C# and .net. I have big legacy files that stores various values (ints, bytes, strings) and want to read them into a C# programme so that I can store them in a...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
6
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
4
by: meendar | last post by:
Hi, I am having a character pointer which contains ascii values. i just want to convert all these ascii values to respective characters and again store it in another character pointer. ...
9
by: =?Utf-8?B?RGFu?= | last post by:
I have the following code section that I thought would strip out all the non-ascii characters from a string after decoding it. Unfortunately the non-ascii characters are still in the string....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.