[comp.lang.c] Displaying non-printable characters on a SPARC

robert@nereid.jpl.nasa.gov (Robert Angelino) (05/03/91)

I'm writing some code that utilizes a primitive tty interface.
I would like to display non-printable characters on my
unix system.  I know in DOS this can be done like so
	printf("%c",175);	(which happens to display a double >)

This will not work on my SPARC.  I've found out (through tracing) that
the following clears the screen:
	print("\33[H\33[2J");	(this also happens to work on VMS)

As you can see this is not what I would call intuitive.  Has anyone out
there discovered how I can go about doing this using simple printf
statements??

thanks in advance

-- 
    -     ------       -                              Robert Angelino
   | |   | ----  \    | |                             ms T-1704L
   | |   | |   \ |    | |                             4800 Oak Grove Drive
   | |   | | --  |    | |                             Pasadena, CA 91109
---| |   | | \__/     | |___                          robert@triton.jpl.nasa.gov
\____|et |_|ropulsion |_____\aboratory                (818) 354-9574

gordon@osiris.cso.uiuc.edu (John Gordon) (05/03/91)

robert@nereid.jpl.nasa.gov (Robert Angelino) writes:

>I'm writing some code that utilizes a primitive tty interface.
>I would like to display non-printable characters on my
>unix system.  I know in DOS this can be done like so
>	printf("%c",175);	(which happens to display a double >)


	This works in DOS because DOS has an "extended character set", that
is, it has 256 defined characters instead of only 128.  This is definitely
*not* portable to other machines.


---
John Gordon
Internet: gordon@osiris.cso.uiuc.edu        #include <disclaimer.h>
          gordon@cerl.cecer.army.mil       #include <clever_saying.h>

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (05/09/91)

In article <6197@mahendo.Jpl.Nasa.Gov>, robert@nereid.jpl.nasa.gov (Robert Angelino) writes:
> I'm writing some code that utilizes a primitive tty interface.
> I would like to display non-printable characters on my
> unix system.

If they _are_ "non-printable" characters, what do expect them to display AS?
If you are writing to a terminal, read your terminal manual.
If you are writing to the console, read your Sun manuals.
Tip:  SunOS 4.something supports 8-bit characters, and comes with
(at least some) fonts for the ISO 8859/1 character set.

> I've found out (through tracing) that the following clears the screen:
> 	print("\33[H\33[2J");	(this also happens to work on VMS)
> As you can see this is not what I would call intuitive.

What do you mean, it's not intuitive?  You send the home-clear sequence
to a terminal, what do you EXPECT it to do?  What's more, this is documented
at tedious length in The Fine Manuals.  Start with "man 1 suntools" and take
it from there.

> Has anyone out there discovered how I can go about doing this using
> simple printf statements??

But you haven't told us what you want to *DO*.  If you do not want ESC
to be recognised as part of a terminal control escape sequence, do you
want it to be displayed as a house, a boat, a picture of Queen Victoria,
or what?  The IBM PC assignments of pictures to codes is _not_ generally
available on other machines (I was enchanted to discover that the upper
128 characters on an Atari 520-ST included Hebrew letters).

It is not an exaggeration to describe SunOS as "copiously" documented.
There are several introductory manuals.  Go read them.

-- 
Bad things happen periodically, and they're going to happen to somebody.
Why not you?					-- John Allen Paulos.