Path: 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 In article <1335@cybaswan.UUCP> iiitsh@cybaswan.UUCP (Steve Hosgood) writes: > printf("\x1bfred"); /* i.e "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 "fred" using a hex escape? The simplest method is to use string concatenation: printf("\x1b""fred");