Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!dsacg1!dcscg1!cpp90221 From: cpp90221@dcscg1.UUCP (Duane L. Rezac) Newsgroups: comp.lang.c Subject: Re: How do I get printf to move to a tab position? Summary: code to print at specific location Keywords: printf, tab, overwrite Message-ID: <284@dcscg1.UUCP> Date: 26 May 88 11:46:23 GMT References: <242@tahoma.UUCP> Organization: Defense Construction Supply Center, Columbus Lines: 38 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..... NOTE: our posting program indicated that my original attempt at posting this may not have made it out, so I am posting it with a diffrent program. If this is a duplicate posting, my appologies. I am a newcomer to C, just finishing my first class in C, but this may help. If you are using an ansi terminal, this code may help. I wrote this printl function in order to let me print to a specific screen position. If you are trying to print to a printer, you could replace the ansi cursor movement statement with the appropriate command sequence for your printer. (If someone knows a better way to do this, Please post it. As I said, I am a novice at C and there may be better ways to do this.) /* printl - print at location x,y x,y = screen position, control=printf template, args=data to be printed This is used just like printf except that an x,y screen position is passsed. (i.e. printl(10,10,"%s",name) prints the string name at column 10, row 10)*/ printl(x,y,control,args) unsigned char *control; unsigned args; int x,y; { printf("\33[%d;%dH",x,y); /* prints ansi cursor movement command to stdout*/ printf(control,args); /* print data */ } I hope this helps.