Здравствуйте. Как в sscanf'e сделать массив при разделении строки по разделителю?
Здравствуйте. Как в sscanf'e сделать массив при разделении строки по разделителю?
Можно конкретнее ?
Мои работы:
_______________________________
Не будь как все, выделяйся из стада.
http://forum.sa-mp.com/showthread.php?t=570927
PHP код:
One of the advanced new specifiers is "a", which creates an array, obviously. The syntax is similar to that of strings and, as you will see later, the delimiter code:
new
arr[5];
sscanf("1 2 3 4 5", "a<i>[5]", arr);
The "a" specifier is immediately followed by a single type enclosed in angle brackets - this type can be any of the basic types listed above. It is the followed, as with strings now, by an array size. The code above will put the numbers 1 to 5 into the 5 indexes of the "arr" array variable.
Arrays can now also be combined with strings (see below), specifying the string size in the array type:
a<s[10]>[12]
This will produce an array of 12 strings, each up to 10 characters long (9 + NULL). Optional string arrays still follow the optional array syntax:
Наверное так: "p<|>a<i>[5]", где | -это разделитель
Из за чего такая ошибка?PHP код:
sscanf error: String/array must include a length, please add a destination size.
https://translate.google.com/#en/ru/...ination%20size
Не указан размер массива.
Индивидуально в ЛС по скриптингу не помогаю. Задавайте все свои вопросы здесь (click).
Стол заказов:
Мои работы:
Не могу разобраться. Голова уже не варит. :(PHP код:
new FractionRanks[MAX_LEN_RANK][MAX_RANK_COUNT];
new result[MAX_LEN_RANK*MAX_RANK_COUNT];
cache_get_value_name(idx,"fractionRanks",result,(MAX_LEN_RANK*FractionInfo[idx+1][FractionRankCount]));
sscanf(result,"p<|>a<s[25]>30",FractionRanks);
Последний раз редактировалось Kol9n99; 27.12.2016 в 15:14.
Всё, разобрался. Спасибо за помощь. Можно закрывать.
PAWN Compiler делает то, что вы приказали ему сделать, а не то, что вы хотели, чтобы он сделал..
25% времени в программировании уходит на размышления о том, что пользователь может сделать не так.[HR]/Брайан Хьюмс/
#FIXSAMP
Эту тему просматривают: 2 (пользователей: 0 , гостей: 2)