A simple approach is to use sprintf:
char req[ SOME_SUITABLE_SIZE ]; sprintf( req, HTTP_GET_MSG, host, path );
but it will be disgusting for a buffer overflow unless you check the length of the host and path in advance. If your system has snprintf , you can avoid this:
snprintf( req, SOME_SUITABLE_SIZE, HTTP_GET_MSG, host, path );
anon
source share