aber ich würde es mit strcat machen
Wozu?
Da er eh format nutzen muss, kann er das doch einfach in die Funktion packen.
Ist doch dann einfacher, übersichtlicher und genauso bzw sogar minimal performanter ![]()
Proof
C
//Beweis Skript:
#include <a_samp>
main()
{
new t = GetTickCount();
for(new i; i<1000000; i++) test1();
printf("Format: %dms",GetTickCount()-t);
t = GetTickCount();
for(new i; i<1000000; i++) test2();
printf("strcat: %dms",GetTickCount()-t);
}
stock test1()
{
new string[128],tmp[]="Hallo",d=5;
format(string,sizeof(string),"%s\nHallo: %d",tmp,d);
}
stock test2()
{
new string[128],tmp[]="Hallo",d=5;
strcat(string,tmp);
format(string,sizeof(string),"\nHallo: %d",d);
}
Alles anzeigen