Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: comp.arch Subject: Re: Null-terminated C strings (desi Message-ID: <28200083@ccvaxa> Date: 28 Dec 87 19:51:00 GMT References: <565@PT.CS.CMU.EDU> Lines: 24 Nf-ID: #R:PT.CS.CMU.EDU:565:ccvaxa:28200083:000:827 Nf-From: ccvaxa.UUCP!aglew Dec 28 13:51:00 1987 ..> Embedding nulls in strings I have frequently used NULs embedded in strings for terminal control applications. Eg. char ControlString[] = "escape string with a \0 inside"; write(fd,ControlString,sizeof(ControlString)-1); So there is an extra null at the end - I'll gladly trade that for the convenience of expressing literals the way I want them. Is this legal C? I thought so. I did this mainly on microcomputers, CP/M and IBM PCs running MANX C. Andy "Krazy" Glew. Gould CSD-Urbana. 1101 E. University, Urbana, IL 61801 aglew@mycroft.gould.com ihnp4!uiucdcs!ccvaxa!aglew aglew@gswd-vms.arpa My opinions are my own, and are not the opinions of my employer, or any other organisation. I indicate my company only so that the reader may account for any possible bias I may have towards our products.