Antonio Coralles <noche.suapie@xxxxxxxxx> writes: > void foo(const std::string& format, ...) > { > unsigned num = string_count("%s", format); // counts how often "%s" > occurs in format > va_list p_arg; > va_start(p_arg, num); > for(; num > 0; --num) > { > const char* arg = va_arg(p_arg, const char*) > // ... do something with the acquired string > } > // ... > } > > as i said, the function works similar to printf, and in printf there's no > second parameter specifying the length of the argument list... It should be va_start (p_arg, format). va_start should always use the last named parameter. Nothing else makes sense. Ian