Function Name: Sprintf function: send formatted output to string Usage: int sprintf (char * string, char * farmat [, argument, ...]);
#include
INT main (void) {char buffer [80];
Sprintf (Buffer, "An Approximation Of PI IS% F / N", M_PI); PUTS (Buffer); Return 0;}
This function is used to format strings. The parameter format is the conversion format, starting to the conversion character with percentage symbol%. And in the format of the conversion includes
Fill in the empty character. 0 The words indicate the space filled with the space; the space is the default value, indicating that the space is placed. Alignment. The default value is to the right, and the negative is left to the left. Field width. For minimum width. Accuracy. Refers to the number of floating point numbers behind the decimal point. Type, see the following table% printed percent symbol, no conversion. B integer is transferred to a binary. The C integer is converted to the corresponding ASCII character. D integer is turned into a ten into the position. F timester accuracy digital is converted to floating point numbers. o Integer is converted into an eight-in-one. The S integer is converted to a string. The X integer is converted to lowercase hexadecimal. X integer is transferred to a capital hexadecion.