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 32 33 34 35 36
| #include <iostream>
#include <stdarg.h>
using namespace std;
// #ifdef vsscanf(const char* __restrict__, const char* __restrict__, __VALIST) <--- PROBLEME
void function(const char* typelist, ...)
{
va_list arg_ptr;
va_start(arg_ptr, typelist);
vsscanf("Test2 3 5 7 Test3", typelist, arg_ptr);
va_end(arg_ptr);
}
// #endif
int main(int argc, char*argv[])
{
char *typelist = "%s %d %d %d %s";
char str[256], str2[256];
int int1, int2, int3;
strcpy(str, "Test");
// #ifdef vsscanf(const char* __restrict__, const char* __restrict__, __VALIST) <--- PROBLEME
function(typelist, str, &int1, &int2, &int3, str2);
cout<<"str: "<<str<<endl;
cout<<"int: "<<int1<<endl;
cout<<"int: "<<int2<<endl;
cout<<"int: "<<int3<<endl;
cout<<"str2: "<<str2<<endl;
// #else
cout<<"vsscanf n'existe pas!"<<endl;
// #endif
system("pause");
return 0;
} |
Partager