Raised This Month: $32 Target: $400
 8% 

Insert one string to another


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neatek
AlliedModders Donor
Join Date: Jul 2010
Location: Russia
Old 12-23-2015 , 15:57   Insert one string to another
Reply With Quote #1

PHP Code:
char one[32]; // #1 equal = ""
char two[68]; // #2 equal = "Hello" 
How to insert data from #2 to #1?
__________________
neatek is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 12-23-2015 , 15:59   Re: Insert one string to another
Reply With Quote #2

https://sm.alliedmods.net/new-api/string/Format
https://wiki.alliedmods.net/Format_C...Mod_Scripting)

This might also suffice, depending on what exactly you're trying to do.
https://sm.alliedmods.net/new-api/string/StrCat
__________________

Last edited by ddhoward; 12-23-2015 at 16:00.
ddhoward is offline
neatek
AlliedModders Donor
Join Date: Jul 2010
Location: Russia
Old 12-23-2015 , 16:05   Re: Insert one string to another
Reply With Quote #3

Quote:
Originally Posted by ddhoward View Post
L 12/24/2015 - 00:02:09: [SM] Plugin encountered error 15: Array index is out of bounds
PHP Code:
Format(one32two); 
PHP Code:
Format(one32"%s"two); 
PHP Code:
Format(one32"%s"two); 
PHP Code:
StrCat(one32two
__________________
neatek is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-23-2015 , 16:24   Re: Insert one string to another
Reply With Quote #4

If you want to overwrite what's already in one with what's in two, use strcopy:

PHP Code:
strcopy(onesizeof(one), two); 
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 19:53.


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