sscanf2 error
#7

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
Because it works and Isn't It faster?
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:

pawn Код:
sscanf("hello 21", "sd", string, integer);
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.

pawn Код:
sscanf("hello", "sd", string, integer);
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.
Reply


Messages In This Thread
sscanf2 error - by Mike Garber - 22.03.2011, 12:29
Re: sscanf2 error - by Zh3r0 - 22.03.2011, 12:31
Re: sscanf2 error - by AK47317 - 22.03.2011, 12:52
Re: sscanf2 error - by Mike Garber - 22.03.2011, 14:05
Re: sscanf2 error - by JaTochNietDan - 22.03.2011, 14:06
Re: sscanf2 error - by Mike Garber - 22.03.2011, 14:08
Re: sscanf2 error - by JaTochNietDan - 22.03.2011, 14:11
Re: sscanf2 error - by Mike Garber - 22.03.2011, 14:13
Re: sscanf2 error - by JaTochNietDan - 22.03.2011, 14:14
Re: sscanf2 error - by Zh3r0 - 22.03.2011, 14:27

Forum Jump:


Users browsing this thread: 1 Guest(s)