17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Built-in Functions<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

All devices.<br />

#INCLUDE <br />

float result;<br />

result=fmod(3,2);<br />

// result is 1<br />

None<br />

None<br />

printf( ) fprintf( )<br />

Syntax:<br />

Parameters:<br />

printf (string)<br />

or<br />

printf (cstring, values...)<br />

or<br />

printf (fname, cstring, values...)<br />

fprintf (stream, cstring, values...)<br />

String is a constant string or an array of characters null terminated.<br />

Values is a list of variables separated by commas, fname is a function name to<br />

be used for outputting (default is putc is none is specified.<br />

Stream is a stream identifier (a constant byte). Note that format specifies do<br />

not work in ram band strings.<br />

Returns:<br />

Function:<br />

undefined<br />

Outputs a string of characters to either the standard RS-232 pins (first two<br />

forms) or to a specified function. Formatting is in accordance with the string<br />

argument. When variables are used this string must be a constant. The %<br />

character is used within the string to indicate a variable value is to be formatted<br />

and output. Longs in the printf may be 16 or 32 bit. A %% will output a single<br />

%. Formatting rules for the % follows.<br />

See the Expressions > Constants and Trigraph sections of this manual for<br />

other escape character that may be part of the string.<br />

If fprintf() is used then the specified stream is used where printf() defaults to<br />

STDOUT (the last USE RS232).<br />

Format:<br />

181

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!