SA-MP Forums Archive
STRCAT - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: STRCAT (/showthread.php?tid=357054)



STRCAT - Jake__ - 05.07.2012

Is it possible to format a string with strcat, like this:



new string1[128];
new string2[32] = "Hello";

strcat( string1, "%s", string2);

// do something with string2 here


Re: STRCAT - Vince - 05.07.2012

No, strcat simply concatenates two strings, nothing more, nothing less. If you want to insert variables you need to format your string first.


Re: STRCAT - Jake__ - 05.07.2012

So would I do it like this?

new string[128];
new string2[32] = "Hello";

format(string, 128, "%s", string2);
strcat(string, "Test");

// do something with string here