Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

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
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.