ARM Technical Support Knowledge Articles

PRINTF LIBRARY ROUTINE PROBLEM WITH 0-LENGTH PRECISION

Applies to: C51 C Compiler

Answer


Information in this article applies to:


SYMPTOMS

I think I have found a problem with the printf library routine. The following example code:

unsigned char t1,t2;
char xdata *unit = "This is a test";

t2 = strlen(unit);
t1 = 0;
printf("test: %.*s(%.*s)\n",(int)t1,unit,(int)t2,unit);

Outputs the following:

test: This is a test(This is a test)

The output from the %.*s should be 0 (zero) bytes long.

CAUSE

You are correct. This is a problem in the library routines of the C compiler.

RESOLUTION

This problem has been corrected in the library of version 6.10 or later. You may download the latest updates from the Keil Website.

MORE INFORMATION

ATTACHED FILES

Request the files attached to this knowledgebase article.

Article last edited on: 2005-10-20 07:38:49

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential