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
Expand Minimize

C6064

warning C6064: missing integer argument to <function> corresponding to conversion specifier <number>

This warning indicates that not enough arguments are being provided to match a format string and one of the missing arguments is an integer. This defect can cause incorrect output.

The following code generates this warning because an incorrect number of arguments were used in call to sprintf and the missing argument was an integer:

#include <string.h>
void f( )
{
  char buff[15];
  char *string="Hello, World";
  
  sprintf(buff,"%s %d", string);
}

To correct this warning, specify missing arguments as shown in the following code:

#include <string.h>
void f( )
{
  char buff[15];
  char *string = "Hello, World";

  sprintf(buff,"%s %d",string, strlen(string));
}

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

#include <string.h>
void f( )
{
  char buff[15];
  char *string="Hello World";

  sprintf_s(buff,sizeof(buff),"%s %d", string, strlen(string));
}
Show:
© 2015 Microsoft