T
Tao
wstring StringFormat(wstring str0, ...)
{
wstring result = str0;
va_list list;
va_start(list, str0);
int i=0;
for(;
{
wchar_t* p=va_arg(list, wchar_t*);
if(p==0)
break;
wstring pattern;
pattern = L"{" + string_streaming::to_wstring(i) + L"}";
//Replace(result, pattern.c_str(), p);
i++;
}
va_end(list);
return result;
}
main()
{
StringFormat("A", "B");
}
The for loop should stop after 1 iteration, but it keeps running and the
wchar_t* p is set to some strange values.
thanks.
{
wstring result = str0;
va_list list;
va_start(list, str0);
int i=0;
for(;
{
wchar_t* p=va_arg(list, wchar_t*);
if(p==0)
break;
wstring pattern;
pattern = L"{" + string_streaming::to_wstring(i) + L"}";
//Replace(result, pattern.c_str(), p);
i++;
}
va_end(list);
return result;
}
main()
{
StringFormat("A", "B");
}
The for loop should stop after 1 iteration, but it keeps running and the
wchar_t* p is set to some strange values.
thanks.