14.12.2012, 13:26
The c in the sscanf format represents a character.
You can make a two-dimensional array like this
Then use sscanf like Babul showed you to store the initials:
The sscanf line does this:
The string "name" is read by sscanf
The first character © it finds will be stored into pIntials[ 0 ].
Then it will search for the first underscore it finds
After it has done that, it will store the next character into pInitials[ 1 ]
This is the best way I can explain this - as I find it quite hard to explain correctly.
You can make a two-dimensional array like this
pawn Код:
new pInitials[2][1] //two arrays - 1 cell each
pawn Код:
sscanf( pName, "c'_'c", pInitials[ 0 ], pInitials[ 1 ]);
The string "name" is read by sscanf
The first character © it finds will be stored into pIntials[ 0 ].
Then it will search for the first underscore it finds
After it has done that, it will store the next character into pInitials[ 1 ]
This is the best way I can explain this - as I find it quite hard to explain correctly.