C6063
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 C6063: missing string argument to <function> 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 string. This defect can cause crashes and buffer overflows (if the called function is of the sprintf
family), as well as potentially incorrect output.
Example
The following code generates this warning:
#include <string.h>
void f( )
{
char buff[15];
sprintf(buff, "%s %s", "Hello, World!");
}
To correct this warning, provide additional arguments as shown in the following code:
#include <string.h>
void f( )
{
char buff[15];
sprintf(buff, "%s %s ", "Hello","World");
}
The following code corrects this warning using safe string manipulation function:
#include <string.h>
void f( )
{
char buff[15];
sprintf_s( buff, sizeof(buff),"%s", "Hello, World!" );
}