wob said:
Hi there,
I wish to show some special characters such as the char for "alpha" and the
symbol for degrees.. Anyone please give me some suggestions how to do that?
The C Standard guarantees the presence of a "basic execution
character set" consisting of upper- and lower-case unaccented
letters, the digits zero through nine, assorted punctuation marks,
and a few special-purpose characters like '\n'. No matter what C
implementation you are using, these characters will be present and
available for your use.
The Standard also permits additional characters in the (non-
"basic") "execution character set." However, it does not require
that additional characters exist, nor does it specify any such
additional characters. The consequence is that any such extra
characters are available only at the whim of the implementation,
and different implementations will have different (possibly empty)
sets of extra characters.
The numeric character code that produces "alpha" one one
implementation may produce "upper left corner" on another and
"the Euro symbol" on still another. Thus, the way you ask for
an "alpha" to be produced will be specific to your system and
may not work on others; you might send "the alpha code" to the
output stream and see nothing but a smiley face or a blank.
The standardization of character sets and character codes is
a relatively recent development, and C has not yet caught up with
it. C still maintains a sort of agnosticism towards such matters
(which is why C is easily implemented on systems that use different
character repertoires), but it does complicate things when one wants
to use "exotic" characters. The trouble arises even within the
family of Latin-ish alphabets: One cannot write "Cosí fan tutte"
or "Götterdämmerung" or "Aïda" with the facilities guaranteed
by C.
So: You're stuck with the unhappy task of trying to figure out
what character codes (if any!) produce "alpha" and "degree sign"
on your system, and with the realization that the same codes might
not do anything sensible on the next system you use. As a purely
practical and ad-hoc approach, you could write yourself a little
program that runs through every `char' value and displays the glyph
your system produces for each. If you happen to find "alpha" and
"degree symbol" among the rendered glyphs you're in luck -- but
never forget that the same codes may do something completely
different on other systems.
There was a perfect world around here somewhere, but I think
I left it in the pocket of my other trousers.