Path: utzoo!utgpu!watserv1!watmath!att!cbnews!jbr0 From: jbr0@cbnews.att.com (joseph.a.brownlee) Newsgroups: comp.sys.mac.programmer Subject: Re: Disinfectant 2.0 Sample Code Message-ID: <1990Jul16.124746.22671@cbnews.att.com> Date: 16 Jul 90 12:47:46 GMT References: <9510@accuvax.nwu.edu> <40562@think.Think.COM> <25571@cs.yale.edu> Distribution: na Organization: AT&T Bell Laboratories Lines: 19 In article <25571@cs.yale.edu> tarr-michael@CS.YALE.EDU (michael tarr) writes: >Think C 4.01 also has a bug in strncpy: > >char s1[10]; >char s2[20] = "A long string"; > >strncpy(s1, s2, 8); > >s1 will not have a '\0' appended to the end. So far as I can tell this >is not per the standard definition. Wrong. It should copy 8 characters from s2 to s1, period, which is exactly what it does. TC is correct. -- - _ Joe Brownlee, Analysts International Corp. @ AT&T Network Systems /_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461 / \ | \_, E-mail: jbr@cblph.att.com Who pays attention to what _I_ say? "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk