AnsweredAssumed Answered


Question asked by Adrian Rockall on Jul 25, 2016
Latest reply on Sep 14, 2016 by David E Seymour


Is the _putstr function in print_prv.c correct?


I'm using KSDK 1.3 + MQX and I am calling:


numChars = sprintf ("%s%s%.19s", data1, data2, data3 );


where data3 is a string containing 48 characters. The value returned is the length of the 3 source strings even though it has only inserted 19 of the 48 characters from data3.

When I look at _putstr it seems to set compare = true after inserting the required number of characters so the count continues to increase.


Should this not set continue = false to abort the loop so the returned count is the number of characters actually inserted?

Also the comments for _putstr state the default value for max_count is 0 (unlimited size), but this would results in no characters being output. Is it the comment or the code that is wrong?


Best regards,