Sprintf() - Documentation for Patrol Agent 22.4

Sprintf() - Documentation for Patrol Agent 22.4

Return the specified format as a character string to a destination.

Syntax

sprintf(format)

Parameter

Parameter

Definition

format

text, variable names, and control characters that specify the content and format of the character string output to the computer or task output window The format permits the following conversion characters: 
%d signed decimal (identical to %i) 
%i signed decimal (identical to %d) 
%u unsigned decimal 
%o unsigned octal 
%x unsigned hexadecimal using abcedf 
%X unsigned decimal using ABCDEF 
%c unsigned character 
%s character string 
%e double-precision form drddde ± ddd where each d is a digit and r is the radix character 
%E double-precision form drdddE ± ddd where each d is a digit and r is the radix character 
%f decimal notation form dddrddd where each d is a digit and r is the radix character 
%g print in the style of %e if the exponent after conversion is less than -4, else print in style %f 
%G print in the style of %E with the precision specifying the number of significant digits 
%N group digits into threes and separate with commas beginning at the right of the string 
%% print a % character 
The format does not support he standard C pointer conversion characters %p and %n.


format 
(continued)


The format permits the following flags: 
- left-justify and pad on the right with spaces 
+ display plus sign when value is greater than zero 
0 pad with zeros if no other padding is specified 
# alters the meaning of a conversion: appends 0x or 0X to the %x and %X conversions always appends the radix character to the %e, %E, %f, %g, and %G conversions retains trailing zeros in the %g and %G conversions 
The # flag does not affect the %c, %d, %s, or %i conversions.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.