We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PrintEx doesn't handle format strings like "%-05d" according to the printf(3) manual page:
If the 0 and - flags both appear, the 0 flag is ignored. ... A - overrides a 0 if both are given.
This results in very bad outputs:
#include <PrintEx.h> void setup() { Serial.begin(115200); PrintEx serial = Serial; // according the printf(3) manual on handling '-' and '0' flags // the outputs below are bad: // outputs: "[-3000]", expected: "[-3 ]" serial.printf("[%-05d]\n", -3); // outputs: [30000], expected: "[3 ]" serial.printf("[%-05d]\n", 3); } void loop() { // no op }
The fix is as simple as modifying 181. line of PrintExtension.cpp from:
if( formatTest( format, CHAR_ZERO ) ) pad |= PAD_ZERO;
to:
// formatTest should been always called to step over ignored 0s if( formatTest( format, CHAR_ZERO ) && pad == 0) pad |= PAD_ZERO;
(I am sorry but have no time to create a pull request.)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
PrintEx doesn't handle format strings like "%-05d" according to the printf(3) manual page:
This results in very bad outputs:
The fix is as simple as modifying 181. line of PrintExtension.cpp
from:
to:
(I am sorry but have no time to create a pull request.)
The text was updated successfully, but these errors were encountered: