Raised This Month: $ Target: $400
 0% 

How do I print EACH character from an array?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-26-2006 , 10:30   How do I print EACH character from an array?
Reply With Quote #1

In C I would just do something like:

Code:
                for ( new i = 0; i < strlen(data); i++ )                 {                     server_print( "%s", data[i] );                 }

But in Pawn this doesn't work, what do I have to do to print each CHARACTER from the array?

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-26-2006 , 10:33  
Reply With Quote #2

Quote:
Originally Posted by Greenberet
Code:
new filename[200], len if(read[i3]!='[') {     len += format(filename[len],199-len,"%c",read[i3]) }
so replace %s with %c
__________________
plop
p3tsin is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-26-2006 , 10:43  
Reply With Quote #3

ok so I try the following code:

Code:
                server_print( "%s", data );                                 for ( new i = 0; i < strlen(data); ++i )                 {                     server_print( "%c", data[i] );                 }                 server_print( "done" );

and the result:

Quote:
mysql_amxx_i386.so




















done
Why doesn't it print the characters ???
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-26-2006 , 10:44  
Reply With Quote #4

Ahem!
Code:
new len = strlen(data); // <----- !! for(new i = 0; i < len; i++) {   server_print( "%c", data[i] ); }
Note: This will not help solve your problem ( at least I don't think it will ). It's just better-er..er.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-26-2006 , 10:45  
Reply With Quote #5

LOL yes I know... I want to solve my problem!!!
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-26-2006 , 10:47  
Reply With Quote #6

haha that fixed it, thanks v3x
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-26-2006 , 10:49  
Reply With Quote #7

Do I own or what?

... wait ... what part?
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 05:01.


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