An experimental clib. Code is taken from some of my (very) old applications.
This printf was done to get formatted output on RS232, from embedded software. I try to get a nice version which does not use too much memory and which is safe to use.
Usage is very similar to printf with limitations.
- %s : to print a string (all modifiers are ignored).
- %c : to print a char (all modifiers are ignored).
- %[0][n][l]d : to print integers (cf. (1)) in decimal. Modifiers are :
- [0] fill with 0 or spaces (default),
- [n] length of filling, must be at most 32 (cf. (2)),
- [l] long integer (cf. (1)).
- %[0][n][l]x : to print integers in hexadecimal. Modifiers are as above.
- %[0][n][l]b : to print integers in binary. Modifiers are as above.
Notes:
- (1) Integers are 16 bits wide and long integers are 32 bits wide.
- (2) No control is done about field length.