Hello,
I am trying to strcat 3 strings, and am having a problem i cant figure out..
One of the string is originally an integer (i), so i am using itoa to convert to a char for the strcat.
Heres my code:
now i was expecting output of the form:Code:for(i=0;i<100;i++) { char buffer [33]; itoa (i,buffer,10); char *numname; numname=strcat("im", buffer); cout<<"numname: "<<numname<<" "; outputname=strcat(numname, ".png"); cout<<"outputname: "<<outputname<<" "; }
numname: im0 outputname: im0.png
numname: im1 outputname: im1.png
numname: im2 outputname: im2.png
wheras i actually get:
numname: im0 outputname: im0.png
numname: im01 outputname: im01.png
numname: im012 outputname: im012.png
I cant seem to figure out the problem.
any help on this would be gratefully recieved.
Rob



LinkBack URL
About LinkBacks



