Insert char array to char array in c -


i insert char array in char array

char test[100]="www.bing.com ";  char headers[256] = "get /index http/1.1\r\nhost: www.bing.com\r\nuser-agent: mozilla/5.0 (compatible; msie 8.0; windows nt 6.0)\r\nreferer: \r\nconnection: close\r\n\r\n"; 

as can see, insert www.bing.com in 2nd array

  char headers[256] = "get /index http/1.1\r\nhost: "+test[100]+"\r\nuser-agent: mozilla/5.0 (compatible; msie 8.0; windows nt 6.0)\r\nreferer: \r\nconnection: close\r\n\r\n"; 

how possible?

char buffer[512]; sprintf(buffer, "get /index http/1.1\r\nhost: %s\r\nuser-agent: mozilla/5.0 (compatible; msie 8.0; windows nt 6.0)\r\nreferer: \r\nconnection: close\r\n\r\n", test); 

buffer contains result want (note how used %s in format string embed test inside http request string)


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -