[SOLVED] snprintf length specifier.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] snprintf length specifier.


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

    Source Code

    1. 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,
    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: segger.com/ticket/

    Or you can contact us via e-mail.