sscanf kustom specifiers and space
#1

Hello, i have a sscanf custom specifiers to check if gang name is exists.
Here is my code:
Код:
SSCANF:gang(string[])
{
	printf("SSCANF:gang string is \"%s\"", string);
	new ret;
	if ('0' <= string[0] <= '9')
	{
		ret = strval(string);
		if(Iter_Contains(Gangs, ret))
			return ret;
	}

	foreach(new i : Gangs)
	{
		if(!strcmp(g_Gang[i][gname], string, true))
			return i;
	}
	return -1;
}
The problem is, it doesn't work while i'm trying to find a gang that have spaces in it.
I've debugged that code by printing "string" variable, and i found out that the string is getting cut off at space.

Код:
new testname[12] = "Gang name", id;
sscanf(testname, "k<gang>", id); // Prints SSCANF:gang string is "Gang"
testname = "Gang_name";
sscanf(testname, "k<gang>", id); // Prints SSCANF:gang string is "Gang_name"
Is there any way to fix this / to make it works?
Thanks in advance.
Reply


Messages In This Thread
sscanf kustom specifiers and space - by X337 - 20.11.2016, 07:44
Re: sscanf kustom specifiers and space - by justice96 - 20.11.2016, 07:50
Re: sscanf kustom specifiers and space - by X337 - 20.11.2016, 07:57
Re: sscanf kustom specifiers and space - by justice96 - 20.11.2016, 08:01

Forum Jump:


Users browsing this thread: 3 Guest(s)