cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/09/21:16:53

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Justification
Date: Sat, 09 May 1998 21:02:19 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 26
Message-ID: <3554FC9B.331F@cs.com>
References: <3554CEB2 DOT 60C442D2 AT beverly-hills-ca DOT com>
NNTP-Posting-Host: ppp119.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jonathan Summers wrote:
> 
> Hopefully this has a simple answer.
> 
> How do you right justify using fprint, so that it comes out looking
> like:
> 
>                 123.45
>                  12.34

I would assume that fprintf() accepts the same format modifiers as
printf(), since they both call the internal function _doprnt().  Read a
C textbook to learn about them.

Quick answer:

    float value = 123.45;
    fprintf( "%10.2f\n", value );

-- 
---------------------------------------------------------------------
|      John M. Aldrich       |"Men rarely (if ever) manage to dream |
|       aka Fighteer I       |up a god superior to themselves. Most |
|   mailto:fighteer AT cs DOT com   |gods have the manners and morals of a |
| http://www.cs.com/fighteer |spoiled child."    - Lazarus Long     |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019