Quote:
Originally Posted by Nowhk
Where am I wrong? I can't just prepend a text in this way? I need a support (temp) variable?
|
Yeah, using a temporary copy of the string should work:
Code:
WDL_String test, tmp;
tmp.Set("Fake Sample.wav");
test.SetFormatted(WAVEPLAYER_PATH_LENGTH, "Error: %s", tmp.Get());
DBGMSG("test: %s", test.Get());
The reason is probably because Get() simply returns a pointer to its internal buffer, but then SetFormatted() updates this same buffer. I guess something similar will happen if you try this:
Code:
char buf[260];
strcpy(buf, "Fake Sample.wav");
sprintf(buf, "Error: %s", buf);
printf("test: %s", buf);