Date: Wed, 9 Apr 1997 17:44:28 -0400 (EDT) From: "art s. kagel IFMX x2697" To: dabrownz AT mindspring DOT com Cc: djgpp AT delorie DOT com Subject: Re: Centering printf text on a 80 column screen In-Reply-To: <334aed58.5263168@news.mindspring.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII void center_print( char *mystring, short field_width ) { short center; center = ((1 + field_width) - strlen(mystring))/2; printf( "%*.*s%s\n", center, center, " ", mystring ); } How's that? The function will print any string centered in a 'field_width' wide zone beginning at the current cursor position on the screen. You can substitute fprintf, sprintf, or cprintf as needed. Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com On Wed, 9 Apr 1997 dabrownz AT mindspring DOT com wrote: > How do you center printf text on a DOS screen? I can't find anyway to > do this other than using tabs and spaces (very annoying). What is the > 'correct' way to do it? Do I have to use 'cprintf' or some other > keyword or include another library? I'd would really appriciate any > help, Thanks. >