Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!uwmcsd1!ig!jade!ucbcad!prefect!moore From: moore@prefect.uucp (Peter Moore) Newsgroups: comp.lang.c Subject: Re: printf and variable length string format (asterisk) Message-ID: <2056@ucbcad.berkeley.edu> Date: Mon, 23-Nov-87 19:24:43 EST Article-I.D.: ucbcad.2056 Posted: Mon Nov 23 19:24:43 1987 Date-Received: Thu, 26-Nov-87 21:29:15 EST References: <692@zycad.UUCP> <19361@yale-celray.yale.UUCP> Sender: news@ucbcad.berkeley.edu Reply-To: moore@prefect.UUCP (Peter Moore) Organization: University of California, Berkeley Lines: 10 what you want is: printf("%.*s", i, string); In a declaration of the form %10.5s, the 10 is the minimum width that the string will take, being padded if necessary. The 5 is the maximum number of characters from the string that will be printed. Peter Moore