Raised This Month: $ Target: $400
 0% 

Sizeof and charsmax?


Post New Thread Reply   
 
Thread Tools Display Modes
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-24-2014 , 21:24   Re: Sizeof and charsmax?
Reply With Quote #11

Quote:
Originally Posted by xPaw View Post
sizeof(array) = 32
charsmax(array) = 31
This is clear enough.
Mostly sizeof is used in loops, when you want to get 31 as a max result and not get "index out of bounds".
Charsmax is mostly used in most of the types of formating strings - where we need to get their maximum cells available, so we won't get "index out of bounds".
And that (1) argument is for the current native (readargv).
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
leo.moraes23
Junior Member
Join Date: Jul 2012
Old 06-24-2014 , 21:29   Re: Sizeof and charsmax?
Reply With Quote #12

Quote:
Originally Posted by Flick3rR View Post
This is clear enough.
Mostly sizeof is used in loops, when you want to get 31 as a max result and not get "index out of bounds".
Charsmax is mostly used in most of the types of formating strings - where we need to get their maximum cells available, so we won't get "index out of bounds".
And that (1) argument is for the current native (readargv).
ahhhh, looks like it's becoming clear to me. As I don't speak English have difficulties in understanding of functions. Thanks Flick3rR Appreciate It.
leo.moraes23 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-25-2014 , 05:20   Re: Sizeof and charsmax?
Reply With Quote #13

You are not understanding the purpose of this theard and that read_argv and sizeof/charsmax are different things.

PHP Code:
new array[32]
read_argv(1, array, sizeof(array)) //This one uses sizeof 
We use sizeof/charsmax to determinate the length of an array/string etc. charsmax = sizeof -1

So:

PHP Code:
new szString 256 ]
sizeof szString ) -charsmax szString 
You can use both of them, read what bugsy posted.

read_argv is something different, search it on the wiki. It allow you to read an argument from a console comand or something like this.
HamletEagle is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode