🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1076

Re: Hexadecimal Escape Sequence

#1076
From: Doug Gwyn
Date: Tue, 16 Jan 1990 11:25
18 lines
1160 bytes
In article <1335@cybaswan.UUCP> iiitsh@cybaswan.UUCP (Steve Hosgood) writes:
>	printf("\x1bfred");	/* i.e "<ESC>fred" */
>... It seems that an infinite number of hex characters may follow the
>\x sequence, though what happens if the result fails to fit in a char is
>undefined.
>Is this what you'd call "expected behaviour"?

It's what I would expect.  Two hex digits is not always enough.

>After all, the octal escape sequence limits itself to 3 characters...

That's a deficiency in the octal escape sequence design that we were
able to remedy for the newly invented hex sequences.

>If it IS correct, how do you write "<ESC>fred" using a hex escape?

The simplest method is to use string concatenation:
	printf("\x1b""fred");
Technical Details
Message-ID: <11960@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!samsung!aplcen!haven!adm!smoke!gwyn
References: <1335@cybaswan.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!samsung!aplcen!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: Hexadecimal Escape Sequence
Message-ID: <11960@smoke.BRL.MIL>
Date: 16 Jan 90 11:25:04 GMT
References: <1335@cybaswan.UUCP>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 18