How do I get printf to move to a tab position?

Shankar Unni shankar at hpclscu.HP.COM
Fri May 27 03:27:42 AEST 1988


Or even uglier and simpler, try programming direct escape sequences if it is
a terminal application:

   printf ("\033&a%dC%s", column, text);   /* HP escape sequences here.. */

Drawbacks:

  1. Non-portable.
  2. Ugly.

If you *really* want to do a portable terminal-based application, use "curses"
or any of its equivalents.

If you want to do this rigmarole with disc files, try some dorktran-like
carriage-control mechanism:

   printf ("%cRESTofFORMAT", CCTL, ...);
	/*
	 * where CCTL ==
	 *	' ' for normal pre-spacing (i.e. start next line)
	 *	'0' for normal double-spacing
	 *	'+' for overstrike (write over current line with
	 *	    NON-DESTRUCTIVE spacing..
	 *	'1' for page eject
	 *	any other char implies a ' ' (may or may not be eaten up).
	 *	or anything else that strikes your fancy
	 */

Then, write a post-processor to translate all this to simple text files
(should be pretty simple). Can even be built in to your application...

Shankar Unni.



More information about the Comp.lang.c mailing list