Is that a typo, or am I missing something?
Mason McCuskey
Spin Studios
www.spin-studios.com
Is that a typo, or am I missing something?
Mason McCuskey
Spin Studios
www.spin-studios.com
I am a fish.\n
// I am a comment.
After the first two lines, x will point to the first slash and y will equal string::npos. Remember that y will never equal -1, because you're using unsigned integers.
x = text.find( "//" );
y = text.find( "\n", x + 2 );
while( x < string::npos )
{
for( unsigned int z = x; z <= y; z++ ) s += text[z];
s = GetTextLine( s, COMMENT_COLOR );
text.replace( x, y-x+1, s );
s = "";
x = text.find( "//", y + 1 );
y = text.find( "\n", x + 2 );
}
btw, this is just the snippet causing it, and if i comment out the line 'text.replace( x, y-x+1, s);' everything works fine...
any input on the matter would be very much appreciated
after many hours trying to get this to work, i finally found the problem... on the for loop, i was including one character too many for the new string 's', i was making it end after the newline, instead of before, so i changed that, and it works perfectly now... its funny how such a time-consuming problem can be traced to a miscalculation of 1
thanks for respond though...