sscanf noob question
#1

Guys can you explain better with an exemple if its possible what does p for exemple

new line[24];
sscanf(line, "p<|>");

What does p and what is that value inside " | "
Reply
#2

AFAIK this will "split" your "variables", for example:

new variable = 0, variable2 = 10, string[4] = "yes", string2[3] = "no";

sscanf(line, "p<|>dds[4]s[3]", variable, variable2, string, string2);

and this will return 0|10|yes|no
Reply
#3

Gh0sts explanation was 100% accurate, it was backwords. sscanf is for unformatting strings, not formatting them. Although he was correct that p<|> means that the delimiter for splitting the string up is the | character. So for example if I have a string that is the following:

pawn Код:
JaTochNietDan:26:12:passwordhash
Then I would use this in sscanf to split it into the specified varibles using the : delimiter:

pawn Код:
sscanf(string, "p<:>s[24]dds[50]", Username, integer, integer2, password_hash);
Does that make sense? See the sscanf documentation for more information, it is all clearly explained there.
Reply
#4

Thank you all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)