ASCII question

Barry Margolin barmar at think.com
Thu Mar 28 08:46:15 AEST 1991


In article <1270 at caslon.cs.arizona.edu> andrew at cs.arizona.edu (Andrei V. Zaitsev) writes:
>I have a question about ASCII code. Can I be sure that character
>with code 13 will return cursor to the beginning of the line
>independently of the terminal type ?

If you're willing to assume that you're talking to an ASCII terminal you
should be pretty safe.  Then again, any ASCII system that supports
non-ASCII terminals probably also has a tty driver that automatically
converts from ASCII; however, if your program writes in raw mode this
conversion would be bypassed.

You're also probably safer using '\r' rather than '\015', since the former
will work properly on a system that uses something other than ASCII
internally.

Some terminals can be configured to perform a line feed automatically after
receiving carriage return.  However, since most Unix software doesn't
expect this, it's safe to assume that the terminal is not in this mode.

--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.unix.questions mailing list