test2の形だと上手く動作しないのですが何故でしょうか
環境はvc6とstlport521です

void test1(const char* cstr, ...) {
char buf[1024];
va_list args;
va_start(args, cstr);
vsprintf(buf, cstr, args);
va_end(args);
printf(buf);
}
void test2(std::string str, ...) {
const char* cstr = str.c_str();
char buf[1024];
va_list args;
va_start(args, cstr);
vsprintf(buf, cstr, args);
va_end(args);
printf(buf);
}
void main() {
test1("hello1 %d\n", 123);
test2("hello2 %d\n", 123);
}
//結果
//hello1 123
//hello2 1819043176