error codes
#5

Quote:
Originally Posted by karolissas
Посмотреть сообщение
Код:
functionB38(arg0, &arg1)
{
	new var0 = strlen(arg0);
	while(arg1 < var0 && arg0[arg1] <= 32)
	{
		arg1++;
	}
	new var1 = arg1;
	new var2[20];
	while(arg1 < var0 && arg0[arg1] > 32 && arg1 - var1 < 19)
	{
		var2[arg1 - var1] = arg0[arg1];
		arg1++;
	}
	var2[arg1 - var1] = 0;
	return var2;
}
So, this function can be executed for non-array arguments.
pawn Код:
functionB38(cmdtext, var1);
cmdtext in this case IS an array. Header of Your function should look like this:
pawn Код:
functionB38(arg0[], &arg1)
{
// ...
By the way, what this code is supposed to do?
The way I see it, is that it just returns part of string, starting at index of arg1 and ending in space (32) sign, and also assigns the value of variable sent via reference to number of characters returned by this command (length, string not it's size)

pawn Код:
new a = 0;
functionB38("abc def", a); // Must be 'a' because of reference. Isn't it pointless?
// returns: abc and 3 (assigned to a)
Isn't it better to use sscanf, which is obviously faster? But still, it's all up to You, whether way You'll choose

Greetings
Reply


Messages In This Thread
error codes - by karolissas - 26.08.2015, 08:52
Re: error codes - by LetsOWN[PL] - 26.08.2015, 08:56
Re: error codes - by karolissas - 26.08.2015, 08:59
Re: error codes - by karolissas - 26.08.2015, 09:01
Re: error codes - by LetsOWN[PL] - 26.08.2015, 09:15
Re: error codes - by karolissas - 26.08.2015, 09:23
Re: error codes - by karolissas - 26.08.2015, 09:43
Re: error codes - by BKarner - 26.08.2015, 13:53

Forum Jump:


Users browsing this thread: 2 Guest(s)