Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!ucla-cs!wales From: wales@valeria.cs.ucla.edu (Rich Wales) Newsgroups: comp.sys.ibm.pc Subject: Re: Turbo C and cprintf(.. Keywords: Ver. 1.5, tabs Message-ID: <20233@shemp.CS.UCLA.EDU> Date: 7 Feb 89 20:25:42 GMT References: <1509@aucs.UUCP> <49044@yale-celray.yale.UUCP> Sender: news@CS.UCLA.EDU Reply-To: wales@CS.UCLA.EDU (Rich Wales) Distribution: na Organization: UCLA CS Department, Los Angeles Lines: 29 In article <49044@yale-celray.yale.UUCP> spolsky-joel@CS.YALE.EDU (Joel Spolsky) proposes the following routine to substitute for the inability of Turbo C 1.5 "cprintf" to handle tabs properly: void tab() { while ((wherex()-1) % 8) cprintf(" "); } I believe there is a problem with this routine. If the cursor is already sitting on a tab stop, it won't print anything at all -- whereas the correct thing to do would be to print eight spaces. How about the following alternative version? void tab() { cprintf(" "); while ((wherex()-1) % 8) cprintf(" "); } The only difference is the addition of a "cprintf" before the "while". -- Rich Wales // UCLA Computer Science Department // +1 (213) 825-5683 3531 Boelter Hall // Los Angeles, California 90024-1596 // USA wales@CS.UCLA.EDU ...!(uunet,ucbvax,rutgers)!cs.ucla.edu!wales "The best diplomat I know is a fully charged phaser bank."