Raised This Month: $ Target: $400
 0% 

How to concat a strings?


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-02-2014 , 06:57   Re: How to concat a strings?
Reply With Quote #21

Do you get the exact same output in your log file as you do when you print to server console? Have you tried printing/logging in sections to see if the text actually exists in the array?
__________________
fysiks is offline
Kapuzzino
Member
Join Date: Jan 2014
Old 02-02-2014 , 07:43   Re: How to concat a strings?
Reply With Quote #22

If so, no, I don't see that a data was gathering together in one page
PHP Code:
    if (socket_change(g_Socket)) 
    { 
        
socket_recv(g_Socketg_Data1023)
             
        
//server_print("%s",g_Data)
    
        
new Position containi(g_Data"</html>"
    
       
//server_print("%s",g_Data);
       
       
strcat(html,g_Data,charsmax(html))
       
       
server_print("%s",html
If I uncomment a line where g_Data prints it into a console, than I see that a page have downloading, but not in a variable html, definitely.
Kapuzzino is offline
Kapuzzino
Member
Join Date: Jan 2014
Old 02-02-2014 , 09:28   Re: How to concat a strings?
Reply With Quote #23

Well, I guess I figured out how to concat a two strings:

PHP Code:
new s1[] = "This is "
new s2[] = "just a test"     
strcat(s1,s2,128)     
server_print(s1
but the last argument it's a maxlength of the result string, how can I know it before the concatenation I can't mind at all.

Last edited by Kapuzzino; 02-02-2014 at 09:29.
Kapuzzino is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 02-02-2014 , 11:56   Re: How to concat a strings?
Reply With Quote #24

Quote:
Originally Posted by Kapuzzino View Post
Well, I guess I figured out how to concat a two strings:

PHP Code:
new s1[] = "This is "
new s2[] = "just a test"     
strcat(s1,s2,128)     
server_print(s1
but the last argument it's a maxlength of the result string, how can I know it before the concatenation I can't mind at all.
PHP Code:
// CHARSMAX(VAR) means SIZEOF(VAR) - 1
//#define charsmax(%0) (sizeof(%0) - 1)
 
// Defines new variable.
new Destination[512];
 
// Sets destination as "Name: ".
formatex(Destinationcharsmax(Destination), "%s""Name: ");
 
// Concatenates "Michael".
// The third argument means the maximum length of Destination variable.
strcat(Destination"Michael"charsmax(Destination));
 
// Output will be:
// "Name: Michael"
//server_print("%s", Destination); 
You can also replace strcat( Dest, Source, SizeofDest ) with add( Dest, SizeofDest, Source ).
__________________

Last edited by claudiuhks; 02-02-2014 at 11:58.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-02-2014 , 16:02   Re: How to concat a strings?
Reply With Quote #25

Quote:
Originally Posted by Kapuzzino View Post
but the last argument it's a maxlength of the result string, how can I know it before the concatenation I can't mind at all.
You already know the max length of the result string because you defined the length of the destination array. You can use charsmax(Destination_Array) for that argument.
__________________
fysiks is offline
Kapuzzino
Member
Join Date: Jan 2014
Old 02-02-2014 , 16:08   Re: How to concat a strings?
Reply With Quote #26

PHP Code:
// Defines new variable.
new Destination[512]; 
@fysiks in this case.
Kapuzzino is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-02-2014 , 16:09   Re: How to concat a strings?
Reply With Quote #27

Quote:
Originally Posted by Kapuzzino View Post
PHP Code:
// Defines new variable.
new Destination[512]; 
@fysiks in this case.
What is your question?
__________________
fysiks is offline
Kapuzzino
Member
Join Date: Jan 2014
Old 02-02-2014 , 16:14   Re: How to concat a strings?
Reply With Quote #28

My general question is to get a web-page into a string and parse some tags with regular expressions. As for this thread, I think it's solved.
Kapuzzino 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 21:00.


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