March 1st, 2002, 09:23 AM
string dissapearing problem using strcpy and strcat
/*Hey all.....I have a little problem.*/
/*I create a string and initialise it*/
/*I also have another string query and later in the code I initialise that.....then I add to it using strcat*/
/*THEN, for some mystical reason.....longstring has, ummm.....dissapeared.....(longstring == "").....funny, huh? especially seeing as it isn't mentioned in the code AT ALL inbetween the points when it's there and when it's not*/
/*one other thing I noticed is that while all this is going through a loop, after a while, (longstring == 0), then after another while, (longstring == 00)......???????*/
anyone have any idea what's going on??????
March 1st, 2002, 11:08 AM
ok, I figured it out........
buffer was being past a string representation of integers in most cases.....but in one it was being passed a double (from sprintf)..... was not big enough to hold , say, 100.000000 ......so it was passing the last few digits into the next string, longstring....which is why it was printing 0, then 00......etc.