Здравствуйте. Как в 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
Не указан размер массива.
Не могу разобраться. Голова уже не варит. :(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);
Всё, разобрался. Спасибо за помощь. Можно закрывать.