Warning C6270
Missing float argument to 'function-name': add a float argument corresponding to conversion specifier 'number'
Remarks
This warning indicates that not enough arguments are 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.
Code analysis name: MISSING_FLOAT_ARGUMENT_TO_FORMAT_FUNCTION
Example
The following code generates warning C6270. sprintf_s
expects a second float argument as denoted by %f
but none is provided:
void f()
{
char buff[25];
sprintf_s(buff, sizeof(buff), "%s %f", "pi: ");
}
To correct this warning, pass the missing float argument as shown in the following code:
void f()
{
char buff[25];
sprintf_s(buff, sizeof(buff), "%s %f", "pi: ", 3.14159);
}
See also
Format specification syntax: printf and wprintf functions
sprintf
, _sprintf_l
, swprintf
, _swprintf_l
, __swprintf_l
sprintf_s
, _sprintf_s_l
, swprintf_s
, _swprintf_s_l
C4473