22.03.2011, 14:11
Well it's not actually doing what you think it's doing. It's not returning false if the strings match, it's just returning false if sscanf finds all of the specified formats in the string, for example:
That's getting the information from hello 21 string, splitting it, and storing it in string/integer accordingly. It returns false there because it was a success.
That will return true, because it failed at getting the integer part of the string, it couldn't find it in the string.
If you want to compare two strings to see if they match, you still use strcmp.
pawn Код:
sscanf("hello 21", "sd", string, integer);
pawn Код:
sscanf("hello", "sd", string, integer);
If you want to compare two strings to see if they match, you still use strcmp.