About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/printf.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 printf Context: slangrtl

Synopsis

Create and write a formatted string to stdout

Syntax

Int_Type printf (String_Type fmt, ...)

Description

fprintf formats the objects specified by the variable argument list according to the format fmt and write the result to stdout. This function is equivalent to fprintf used with the stdout file pointer. See fprintf for more information.

printf returns the number of characters written to the file, or -1 upon error.

Many C programmers do not check the return status of the printf C library function. Make sure that if you do not care about whether or not the function succeeds, then code it as in the following example:

     () = printf ("%s laid %d eggs\n", chicken_name, num_egg);
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.