[SOLVED] snprintf length specifier.

  • Hi,

    I've the following format specifier in a snprintf function:


    Code
    snprintf(bufferp, bufferSize, "%hhd\n", -1);


    Unfortunately, this results in the string '255', instead of -1. When I remove the 'hh' part, then -1 is correctly converted to '-1'.
    I've set the 'Printf Width/Precision supported' to Yes in the project configuration.
    I'm using SES 5.42 on a Mac.

    Is this a bug?

    Thanks in advance.

    Kind regards,

    Remco Poelstra

  • Hi Remco,
    Thank you for your inquiry.

    I forwarded this matter to the related department.
    We will come back to you as soon as possible.

    Best regards,
    Fabian

    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: https://www.segger.com/ticket/

    Or you can contact us via e-mail.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!