SA-MP Forums Archive
strlen issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strlen issue (/showthread.php?tid=525388)



strlen issue - PaulDinam - 11.07.2014

I'm trying to do something like,
pawn Код:
new chars[strlen(string)];
But it doesn't work, is there any other way to create an array using a length of another string?


Re: strlen issue - AMouldyLemon - 11.07.2014

Just put the size there.. I don't really see the point in doing what you are doing.


Re: strlen issue - Scrillex - 11.07.2014

new chars [your amount];


Re: strlen issue - ikey07 - 11.07.2014

array size must be indexed aka you need to give a size to chars array, strlen(string) will never work, you need a static value, such as new chars[32]; there is no such thing as dynamic arrays, at least in pawn.


AW: strlen issue - Nero_3D - 11.07.2014

What you are looking for is y_malloc, it allocates a part of the stack and you can manage it with it