Path: utzoo!attcan!uunet!husc6!purdue!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: How do I get printf to move to a tab position? Keywords: printf, tab, overwrite Message-ID: <11572@mimsy.UUCP> Date: 19 May 88 14:28:23 GMT References: <242@tahoma.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 In article <242@tahoma.UUCP> jwf0978@tahoma.UUCP (John W. Fawcett) writes: >... 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. Do what FORTRAN does: print on a card punch or line printer. Then those pesky spaces will not overwrite the non-spaces. :-) Seriously, most FORTRAN implementations have no idea how to back up; they simply keep track of the current column, and when asked to get to column 30 (via T, not X: X means blanks), print 30-current_column blanks. This approach works fine in C as well, but you have to count the columns yourself. Your operating system (which is not part of the C language) most likely provides a higher-level screen management library, if you have more ambition. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris