Trying to add format(char *strFormat, ...) to String class

void String::format(char *strFormat, ...) 
{ 
  va_list argptr;  
  va_start(argptr, strFormat); 
  changeBuffer(40);
  len = vsnprintf(buffer, capacity, strFormat, argptr);
}

I have copied it from the same function in class PString but it is not working and I don't understand why.

With a format string passed to my function "%s %01d-%01d-%02d %01d:%01d:%01d" I am only getting the %s printed into the 'buffer' member of class String.

Can anyone suggest how I can make it work properly?

I would have though it was a pretty trivial modification of the equivalent function in the PString class.

Does function vsnprintf not work with pointers to C strings allocated on the heap?

int PString::format(char *str, ...) 
{ 
  va_list argptr;  
  va_start(argptr, str); 
  int ret = vsnprintf(_cur, _size - (_cur - _buf), str, argptr);
  if (_size)
     while (*_cur) 
        ++_cur;
  return ret;
}