C++ sprintf sprintf_s

char query[100];
char* name = "username";
char* pass = "password";
sprintf_s(query,sizeof(query),"%s%s%s%s%s","select * from account where name = \"",name,"\" and password = \"",pass,"\";");


Visual Studio 2012得用sprintf_s,sprintf会报错。

你可能感兴趣的:(C++)