Path: utzoo!attcan!uunet!husc6!mailrus!tut.cis.ohio-state.edu!osu-cis!n8emr!oink!jep From: jep@oink.UUCP (James E. Prior) Newsgroups: comp.lang.c Subject: Re: How do I get printf to move to a tab position? Keywords: printf, tab, overwrite Message-ID: <265@oink.UUCP> Date: 24 May 88 23:54:29 GMT References: <242@tahoma.UUCP> Reply-To: jep@oink.UUCP (James E. Prior) Organization: Random Prime Research Institute Columbus, Ohio Lines: 30 In article <242@tahoma.UUCP> jwf0978@tahoma.UUCP (John W. Fawcett) writes: >I have what may actually be a simple question, but I could not find an >answer in my K & R. I would like to be able to tab over to a certain >position on a line and place some text there without overwriting text that >was already on the line, similar to the "X" format descriptor in FORTRAN. >The closest I can come so far is to use a "%20s", but this overwrites >whatever was there. Any help out there? > > Thanks, > John > >John W. Fawcett Voice: (206) 237-2564 >Boeing Commercial Airplanes UUCP: ..!uw-beaver!ssc-vax!shuksan!tahoma!jwf0978 printf() is pretty simple. It is so simple that it doesn't know or care what column you're at on a line. The following trick, albeit ugly, might work: printf("...\r%*s...",...,width,"",...); I admit to not having tried it. If it works, but it still too ugly, or unsuitable due to the overprinting, you'll probably have to resort to something else than printf(). Good luck, -- Jim Prior {ihnp4|osu-cis}!n8emr!oink!jep jep@oink.UUCP Pointers are my friend.