Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!ogicse!ucsd!hub.ucsb.edu!fig!angst From: angst@fig.ucsb.edu (Hopelessly in love w/Donna Reed) Newsgroups: comp.lang.c Subject: Re: How to separate numbers in three-digit groups in C Message-ID: <12197@hub.ucsb.edu> Date: 24 Jun 91 18:44:56 GMT References: <1991Jun23.174550.14820@umbc3.umbc.edu> <12192@hub.ucsb.edu> <1991Jun24.134512.27162@leland.Stanford.EDU> Sender: news@hub.ucsb.edu Reply-To: angst@cs.ucsb.edu (Hopelessly in love w/Donna Reed) Organization: Funf auf def nach oben offenen Richterskala Lines: 22 In article <1991Jun24.134512.27162@leland.Stanford.EDU> dkeisen@leland.Stanford.EDU (Dave Eisen) writes: >In article <12192@hub.ucsb.edu> angst@cs.ucsb.edu (Hopelessly in love w/Donna Reed) writes: >>This function will work. It assumes the number is contained in a string >>(which you can do by using sprintf()) -- >> > >No it won't. It bombs on -123 for example. True, my solution doesn't work for negative numbers. Add the following as the first line of the function: if (s && *s == '-') { putchar ('-'); s++; } -d "Let the fools have their tartar sauce." | Dave Stein - Mr. Burns | angst@cs.ucsb.edu | angst%cs@ucsbuxa.bitnet