C sscanf formatting

I can't quite get this figured out.
sscanf (StringName, "%*[^0-9]%d::%d::%*d::INSTR", &1stVar, &2ndVar);
This writes into Stringname "VarA::VarB::VarC" where
1stVar is copied to VarA stripped of anything numeric.
If anything is left over it's written to VarB.
2ndVar is written to VarC.
Looks like one argument is missing but I don't know what %*d does.
You are not quite right:
sscanf READS from StringName.

%*[^0-9] read and discard any non-numeric characters

%d read a decimal to 1stVar

:: read and discards two colons.

%d Read a decimal to 2ndVar

:: read and discards two colons

%*d read and discard a decimal

::INSTR read and discard these characters.


Edit:
The * means discard/throw away
Last edited on
Topic archived. No new replies allowed.