I am trying to pass on a list of arguments to sprintf which apparently doens’t pick them up. What am i missing?
void respond( const char *format, ...) {
char buffer[256];
va_list args;
int len, retCode;
va_start( args, format);
len = sprintf( buffer, format, args);
va_end( args);
retCode = send( newSockFD, buffer, len, 0);
if( retCode == -1) error( "Could not write to socket");
}
sprintf can not work with varable argument so use
vsnprintf()