sscanf help, two string parameter
#1

I have a command which requires you to select an option and then asks you to enter a text.

/sign put [text]

This is my sscanf

if(sscanf(params, "s[32]s[128]", option, text))

option should be 'put'
text should be whatever is in [text]

But it doesn't work. Why? What specifiers should I be using?

Thanks.
Reply
#2

This can be done without the use of sscanf since it is only expecting a single parameter after which is string.

pawn Код:
if (!strcmp(params, "put", true, 3))
{
    // "params[3]" in replace of "text"
}
Reply
#3

Doesn't work.
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
This can be done without the use of sscanf since it is only expecting a single parameter after which is string.

pawn Код:
if (!strcmp(params, "put", true, 3))
{
    // "params[3]" in replace of "text"
}
Shouldn't it be params[4] and "put " though?
Because I think if you use "put", this would work: /sign puttext
Reply
#5

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Shouldn't it be params[4] and "put " though?
Because I think if you use "put", this would work: /sign puttext
You are correct, sorry about that.

pawn Код:
if (!strcmp(params, "put ", true, 4))
{
    // "params[4]" in replace of "text"
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)