Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
C6271
Collapse the table of content
Expand the table of content

C6271

warning C6271: extra argument passed to <function>: parameter <number> is not used by the format string

This warning indicates that additional arguments are being provided beyond those specified by the format string. By itself, this defect will not have any visible effect although it indicates that the programmer's intent is not reflected in the code.

The following sample code generates this warning:

#include <stdio.h>
#include <string.h>

void f()
{
   char buff[5];

   sprintf(buff,"%d",1,2); 
}

To correct this warning, use the following sample code:

#include <stdio.h>
#include <string.h>

void f()
{
   char buff[5];

   sprintf(buff,"%d, %d",1,2);
}

The following sample code calls the safe string manipulation function, sprintf_s, to correct this warning:

#include <stdio.h>
#include <string.h>

void f()
{
   char buff[5];

   sprintf_s( buff, 5,"%s %d", 1,2 ); //safe version
}
Show:
© 2015 Microsoft