Re: PrintF question

From: Jochen Van den Bossche <Jochen.Van-Den-Bossche_at_eurocontrol.be>
Date: Tue, 22 Dec 1998 08:01:12 +0000
Message-ID: <367F51C8.1B09_at_eurocontrol.be>


Gerard Tromp wrote:
>
> NeedaHoliday wrote:
> >
> > Could someone please explain the following printf command.

                                                       ^^^^^^
This is an Fprintf: print to File. The first argument (fp) is a file pointer.
The two '\n' are new line indicators: one blank line will be inserted in the file.
String conversion explenation seems OK to my knowledge of C.

> >
> > fprintf(fp, "%-10.10s%-20.20s\n\n", MONTH, hc_inv_per);
> ^^^^^^^^^
> %s -- string conversion
> - flag -- left justification
> 10.10 -- width and precision
> where width is the minimum i.e. padded with blanks
> precision is the maximum, longer strings are truncated
>
> This statement expects two string arguments and the programmer wants at
> least
> 10 characters and no more than 10 characters printed, i.e. exactly 10,
> for the first argument, and exactly 20 characters for the second.
>
> Gerard
> --
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Gerard Tromp, Ph.D.
> CMMG, Wayne State University vox: 313-577-8773
> 3116, Scott Hall fax: 313-577-5218
> 540 E Canfield Ave e-mail: tromp_at_sanger.med.wayne.edu
> Detroit, MI 48201 gtromp_at_cmb.biosci.wayne.edu
Received on Tue Dec 22 1998 - 09:01:12 CET

Original text of this message