Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

C6063

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!" );
}

See Also

Community Additions

ADD
Show:
© 2015 Microsoft