Share via


C6270

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C6270: missing float argument to <function>: add a float argument corresponding to conversion specifier <number>

This warning indicates that not enough arguments are being provided to match a format string; at least one of the missing arguments is a floating-point number. This defect can lead to crashes, in addition to potentially incorrect output.

Example

The following code generates this warning:

#include <stdio.h>  
#include <string.h>  
  
void f()  
{  
  char buff [25];  
  sprintf(buff,"%s %f","pi:");  
}  
  

To correct this warning, pass the missing argument as shown in the following code:

#include <stdio.h>  
#include <string.h>  
  
void f()  
{  
  char buff [25];  
  sprintf(buff,"%s %f","pi:",3.1415);   
}  

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

#include <stdio.h>  
#include <string.h>  
  
void f()  
{  
  char buff [25];  
  sprintf_s( buff, 25,"%s %f", "pi:",3.1415 );  
}  

See Also

sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l