Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rochester!rit!tropix!moscom!ur-valhalla!uhura.cc.rochester.edu!sunybcs!rutgers!cs.utexas.edu!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: In defense of scanf() (Re: Re^2: scanf(..)) Message-ID: <4596@ficc.uu.net> Date: 22 Jul 89 15:05:16 GMT References: <225800176@uxe.cso.uiuc.edu> <11831@bloom-beacon.MIT.EDU> <824@cbnewsl.ATT.COM> Organization: Xenix Support Lines: 20 In article <824@cbnewsl.ATT.COM>, mpl@cbnewsl.ATT.COM (michael.p.lindner) writes: > In article <4563@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes about scanf: > > I tend to stick with strspn() and strtok(), myself. > Hope you never have to do anything complex. If you call strtok on e string > in the middle of a strtok of another string it trashes its state information > on the first string (a little known feature), which can cause extremely > elusive bugs. Sounds like something too fancy for scanf, too. But thanks for the info... I've never gotten that complex with strtok. By that time I'm usually stepping through the string by hand (while (strchr(*s, legalchars)) s++;)... [files away information that there are broken implementations of strtok...] -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Personal: ...!texbell!sugar!peter, peter@sugar.hackercorp.com.