Partilhar via


C6064

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 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.

Example

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

See Also

sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l