|
Prints formatted text to the shell stream.
- Parameters
-
desc | Shell service descriptor. |
format | Format string. |
- Returns
- This function returns the number of characters that were successfully output.
- See also
- fnet_shell_putchar(), fnet_shell_getchar(), fnet_shell_println()
This function outputs formatted text to the shell stream.
The function takes one or more arguments. The first argument is a string parameter called the "format string". The optional arguments following format are items (integers, characters or strings) that are to be converted to character strings and inserted into the output of format at specified points.
The syntax for a format placeholder is "%[Flags][Width][Length]Type".
- Flasgs can be omitted or be any of:
- : Left justify.
+ : Right justify.
0 : Pad with leading zeros.
- space : Print space if no sign.
- Width is minimum field width. It can be omitted.
- Length is conversion character. It can be omitted or by any of:
h : Short integer.
l : Long integer.
- Type can by any of:
d , i : Integer.
u : Unsigned.
x , X : Hexadecimal.
o : Octal.
b : Binary.
p : Pointer.
c : Single char.
s : Char string.
n : Nothing. - Note
- To save some bytes from all the hard coded strings the (s)printf() functions will expand all line feeds ("\n") inside the format string to CR LF ("\r\n"). So do not use "\r\n" in the format string - it will be expanded to "\r\r\n". It is save to add it via a parameter though, e.g. fnet_printf("%s", "\r\n");
This feature can be disable/enabled by the FNET_CFG_SERIAL_PRINTF_N_TO_RN configuration parameter.
|