Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcnc!gatech!bloom-beacon!oberon!cit-vax!elroy!ames!lll-lcc!ptsfa!nonvon!gilsys!mc68020
From: mc68020@gilsys.UUCP (Thomas J Keller)
Newsgroups: comp.lang.c
Subject: output formatting in C
Message-ID: <1085@gilsys.UUCP>
Date: Fri, 17-Jul-87 22:15:49 EDT
Article-I.D.: gilsys.1085
Posted: Fri Jul 17 22:15:49 1987
Date-Received: Sun, 19-Jul-87 19:53:43 EDT
Organization: Consequently Computers, Santa Rosa, Ca
Lines: 22
Keywords: print using, column alignment


   A friend of mine is writing a program which will, among other things,
output some columnar data.  He wishes to have the columns alingned so that
the decimal points of each number are aligned.  

   His background is in BASIC, and as he points out, in BASIC, a simple
PRINT USING command would solve this problem.  He asked me for a solution
in C.  The only thing I've been able to think of is some piece of code which
analyzes the output as a formatted string (sprintf'ed), which is passed the
column in which the decimal is to be placed, and adjusts the string
accordingly.  Such a function would be relatively simple to cobble, I
suspect, but it seems to me that it would be fairly time consuming at
execution time.

   Is there a better (or already existing) solution to this problem?

-- 
Tom Keller  The essential point that so-called "Libertarians" miss in their 
	    rabid naivete` is a very sad but true observation:  there *ARE* 
	    no solutions. 

UUCP:{ihnp4,ames,qantel,sun,amdahl,lll-crg,pyramid}!ptsfa!gilsys!mc68020