Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.std.c Subject: Re: Escape sequences for printf() defined by SVID Keywords: escape sequences printf SVID Message-ID: <1974@crdos1.crd.ge.COM> Date: 3 Jan 90 17:43:53 GMT References: <1990Jan3.144808.6319@sssab.se> Distribution: comp Organization: GE Corp R&D Center, Schenectady NY Lines: 29 Reply-exos:@crdgw1:To: davidsen@crdos1.crd.ge.com (bill davidsen) In article <1990Jan3.144808.6319@sssab.se> sveer@sssab.se (Sven L Eriksson) writes: | Everybody knows that escape sequences like these works fine with printf | | printf("\thello\n") ; | | Usually these escape sequences are recognized and converted by the | compiler. If the compiler is one for the C language, ALL escape sequences are converted to their single character form. Not usually, always. | | However SVID (Issue 2) states that the format string may contain these | escape sequences. This implies that it is possible for the actual | format string printf sees to contain the characters '\' and 'n', and | still be converted into a newline. This whould be very convenient if | the format string is received from elsewhere, e.g. stdin. I hope your misreading this... it isn't common to include stuff like this, but an error message might well do so. If I define a string as "xx\\n" it will have two x's, one \, one n, and a terminating zero byte. That is what you get printed with existing C compilers, and I doubt that SVID breaks it. For that matter, what has SVID got to do with the C language, and why are they even mentioning this? X3J11 didn't respecify the unix calls ;-) -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon