Should i use sprintf to add strings ?


now doing in wrong way :


code: [select]
  #define host_name name
  #define host_port  80
     
 string cntcmd="at+cipstart=0,\"tcp\"," +  string(host_name) + "," + string(host_port )  ;



should go instead (in memory considerations):

code: [select]
sprintf(cntcmd,"at+cipstart=0,\"tcp\",\"%s\",%d",host_name,host_port);

is or missing here ?

 
 

thank .

how cntcmd array declared ?


Arduino Forum > Using Arduino > Programming Questions > Should i use sprintf to add strings ?


arduino

Comments