Raised This Month: $ Target: $400
 0% 

strlen not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-24-2018 , 12:09   strlen not working
Reply With Quote #1

PHP Code:
    new const String[] = "abcd";
 
    new 
len strlen(String);
    
    for(new 
0leni++) {
        
console_print(0"%s"String[i]);
    } 
console output:

Code:
abcd
abc
ab
a
for String[0] it prints "abcd" :O

Last edited by BaD CopY; 07-24-2018 at 12:11.
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-24-2018 , 12:11   Re: strlen not working
Reply With Quote #2

It is working correctly. If you want to print a single character use "%c" instead.
__________________
klippy is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-24-2018 , 12:13   Re: strlen not working
Reply With Quote #3

Thank you, I didnt know that
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-24-2018 , 13:44   Re: strlen not working
Reply With Quote #4

Quote:
Originally Posted by BaD CopY View Post
console output:
Code:
abcd
abc
ab
a

How u got that when index is increasing ?

Correct is:


Code:
abcd
bcd
cd
d
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 07-24-2018 at 13:44.
Ghosted is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-24-2018 , 14:22   Re: strlen not working
Reply With Quote #5

Quote:
Originally Posted by Ghosted View Post
How u got that when index is increasing ?

Correct is:


Code:
abcd
bcd
cd
d
You are right.. remembering error
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-24-2018 , 15:05   Re: strlen not working
Reply With Quote #6

Mark as solved.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2018 , 21:14   Re: strlen not working
Reply With Quote #7

You need to learn how to do some basic debugging. If you think there is something wrong with strlen() then you should have determined the value that was actually being provided by strlen(). If you did that then you would know that there is nothing wrong with strlen().
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 12:49.


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