[QUESTION]About "format".
#1

Hi.
I have a little question, is possible make biggest formats? Because if I use too much characters it'll crash my compiler.
And strcat wasn't made for formatting strings.

Well, any suggestion?

Best regards!
Reply
#2

format() at any rate shouldn't crash your compiler, it should give you a warning.

If you format a string that is too long, you can always begin formatting again on another line and include the old formatted string, like so:

pawn Код:
new szTestString[128];
format(szTestString, sizeof(szTestString), "asfmdasflmkasflkmasflmkalkmsfalkmsfalkmsflmkas");
format(szTestString, sizeof(szTestString), "%s asfmdasflmkasflkmasflmkalkmsfalkmsfalkmsflmkas", szTestString);
Reply
#3

Hahaha... Good idea bro.
It works, thanks a lot.

EDIT:
Now I have another problem.
For example if I want make something like this:
pawn Код:
format(strings, sizeof(strings),"first format lalalalala");
format(strings, sizeof(strings),"%s "AV"%s",strings,Other);
Other won't appear. =/
Reply
#4

You need to escape quotemarks by putting a backslash behind them. Also make sure the 'strings' array is large enough.
Reply
#5

It works perfect with less characters, but if I add 4 or more characteres , It won't compile and the compiler crash.
And "strings" is large enough, It will crash too if I put 500. I need something like strcat, but with it I can't format strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)