1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdarg.h>
#include <cstdint>
std::string Format(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
char buffer[128]; // large enough?
vsnprintf(
buffer, sizeof(buffer), fmt, args);
va_end(args);
return buffer;
}
int main(int argc, char *argv[])
{
std::string Username = "Krofna";
std::string Password = "password";
std::string str = Format(
"INSERT INTO `players` VALUES (%u, '%s', '%s', 0, 0, 'dg_classm32.gif', 0, 0, 0, 0, 0)",
(uint64_t)0xFFFFFFFFFFFF, Username.c_str(), Password.c_str());
std::cout << str << std::endl;
std::cin.get();
return 0;
}
|