From: utzoo!decvax!duke!trt Newsgroups: net.unix-wizards Title: Re: %r format item in some printf implem - (nf) Article-I.D.: duke.2546 Posted: Sat Sep 18 16:25:05 1982 Received: Wed Sep 22 10:07:26 1982 References: esquire.393 Due to the lack of a clearly portable way to provide routines like: warn("Cannot open %s", filename); Steve Daniel (duke!mcnc!swd) used the following for "A news": char bfr[BIGENOUGH]; /* handy global buffer */ ... sprintf(bfr, "Cannot open %s", filename); warn(bfr); This way of handling variable numbers of arguments is portable, fairly easy to use, and can be used to invoke *any* routine, not just those written to handle printf-style format: sprintf(bfr, "%s/%s", dir, name); fp = fopen(bfr, "r"); If sprintf(III) returned a pointer to the result string (which alas is not true of some versions) one could just type: fp = fopen(sprintf(bfr, "%s/%s", dir, name), "r"); Tom Truscott (duke!trt)