Quote:
Originally Posted by SpawnerF
Code:
Strings should never be returned from functions especially general purpose functions.
What do you suggest then?
|
Strings should be passed as byref function parameters the same way that every AMX Mod X function that generates a string as its output. For example, get_user_name() takes the string array and the length as parameters.
Quote:
Originally Posted by SpawnerF
Code:
I'm not sure what angle brackets do for creating an array but it's not wise to use extremely obscure features when providing support on these forums unless it's the only way to do it.
It's a macro replaced by the pre-processor, I add it because when I do charsmax(p_szOutput[]) I get an error saying "indeterminate array size" but nvm It's fixed I updated my code adding the size parameters using sizeof in Split func.
|
charsmax and sizeof are pre-processor functions so it is not possible to use them on arrays that don't have a determined size at compile time. Therefore, you can't use them on any variables in a function's prototype that doesn't have a defined size.
Given this, I don't know how your Split() function can actually work since you are using sizeof in the function's prototype. Not sure why it even compiles. If you need to know the dimensions of the arrays provided to the function, you'll need to pass those dimensions into the function as shown in the URL that you referenced.
Did you test your code?
__________________