Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: utzoo!linus!decvax!ittvax!dcdwest!sdcsvax!laman From: laman@sdcsvax.UUCP Newsgroups: net.lang.c Subject: Re: C pre-processor and ANSI standard Message-ID: <47@sdcsvax.UUCP> Date: Mon, 10-Sep-84 09:57:39 EDT Article-I.D.: sdcsvax.47 Posted: Mon Sep 10 09:57:39 1984 Date-Received: Sun, 16-Sep-84 08:26:50 EDT References: <572@calgary.UUCP>, <8214@umcp-cs.UUCP> Organization: EECS Dept. U.C. San Diego Lines: 16 If you want a macro to write "n" spaces try: #define spaces(n) printf("%*s", n, "") This of course will only work on systems that understand a '*' flag in printf(). The '*' flag goes back to V7, if memory serves me right. Mike Laman, NCR @ Torrey Pines UUCP: {ucbvax,philabs,sdcsla}!sdcsvax!laman P.S. What about a negative "n" you say. Try: #define spaces(n) printf("%*s", (n <= 0) ? 0 : n, "") If you want to worry about if-then-elses then go ahead and pull the check out of the arguments so you can side step the printf.