
/* send a message of arbitrary size, sending the size first */
int Example (int device, char *format, ...) {

  int Nbyte;
  char tmp, *string;
  va_list argp;  

  /* discover line length by setting output length to 0
     MUST have a valid buffer even though it is not used */
  va_start (argp, format);
  Nbyte = vsnprintf (&tmp, 0, format, argp);
  va_end (argp);

  /* allocate space for the string + NULL end char */
  ALLOCATE (string, char, Nbyte + 1);
  memset (string, 0, Nbyte + 1);

  /* need to restart varargs at this point */
  va_start (argp, format);
  vsnprintf (string, Nbyte + 1, format, argp);
  va_end (argp);
}
