Date: Sun, 29 Mar 1998 14:29:36 +0300 (IDT) From: Eli Zaretskii To: Cloud Wu cc: djgpp AT delorie DOT com Subject: Re: cprintf() 's question In-Reply-To: <351C6FD4.7393@nease.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sat, 28 Mar 1998, Cloud Wu wrote: > cprintf("%-*s",WIDTH,s); > ... > > but, the left of my string s was cut. :-( > The right part of the string was printed in the middle of screen. > I remember, "%-*s" is to say leftjustify the output, Strings printed with %s format are always left-justified, so you don't need the `-' flag. And for %s format, the maximum number of characters is given by the precision, not by width. So you need to say this instead: cprintf ("%.*s, WIDTH, s); Btw, was the string in `s' null-terminated? If not, you can have all kinds of weird effects. (Sorry for asking the obvious, but you didn't post enough of your source to deduce the answer from there.)