Double specifier?. sscanf
#1

Hello. Could we put two specifiers for 1 Parameter ?. For example: "is[5], intstring". To use a parameter as an integer and string.
Reply
#2

No langages allow you to mix an integer and a string.
I don't see what do you want to make.
Reply
#3

In that case, just use a string and convert that string in to a value when needed, and use the string as it is when necessary.
Reply
#4

Quote:
Originally Posted by GranaT3
Посмотреть сообщение
Hello. Could we put two specifiers for 1 Parameter ?. For example: "is[5], intstring". To use a parameter as an integer and string.
Elaborate...
Reply
#5

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
Elaborate...
Nothing to.
He wants to set:
PHP код:
new whatever[50]; //String, right?
//he wants to do this
whatever 20//int 
What will not work.
Reply
#6

Quote:
Originally Posted by Jamester
Посмотреть сообщение
PHP код:
new whatever[50]; //String, right?
//he wants to do this
whatever 20//int 
What will not work.
Pawn isn't made for this use.
Reply
#7

Just use a string and get its integer value with strval.
Reply
#8

Quote:
Originally Posted by Kevln
Посмотреть сообщение
Just use a string and get its integer value with strval.
sscanf does it.
Reply
#9

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
sscanf does it.
Of course.

pawn Код:
new string[3], integer;
strcat(string, "55");

if(sscanf(string, "i", integer))
{
    // Use "integer".
}
else
{
    // Use "string".
}
Either way.
Reply
#10

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Pawn isn't made for this use.
I know. Did you read my post?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)