I've hit a bit of a snag in my program. My string is terminating at the wrong point but I'm not sure why. I'm building my string up from several compressed numbers, using a small compression routine, which I'm certain is fine because I took it from the Blitzplay library.
When I follow it through on the debugger, I can see the little strings being built up - for example, they'll show 'A', then 'A^', then 'A^f'. The quotation marks are clear around the string as it builds up. But when I put a certain number into the function, it shows 'Me .... but no closing quotation mark. Then when I add that string to the bigger string, the big string also terminates at that point, and adding anything else to it seems to make no difference (it does seem to get longer, but I can't see anything after that point).
The function is as follows.
It goes wrong when the number 25933 is put into it.
Any ideas? I'm guessing I'm making some really obvious mistake here :(
When I follow it through on the debugger, I can see the little strings being built up - for example, they'll show 'A', then 'A^', then 'A^f'. The quotation marks are clear around the string as it builds up. But when I put a certain number into the function, it shows 'Me .... but no closing quotation mark. Then when I add that string to the bigger string, the big string also terminates at that point, and adding anything else to it seems to make no difference (it does seem to get longer, but I can't see anything after that point).
The function is as follows.
Function IntToStr$(Num%,StrLen%=4) ;-=-=-=Take an Integer and compress it to a string, of "strlen" bytes long. Local shiftin% Local st$=Chr$(num And 255) For shiftin=1 To (strlen-1) st$=st$+Chr$(num Sar(8*shiftin)) Next Return st$ End Function
It goes wrong when the number 25933 is put into it.
Any ideas? I'm guessing I'm making some really obvious mistake here :(