sscanf format.
#1

Hi,

1. I want to make with sscanf command, you can input 10 time intervals like: HH:MM, HH:MM ...

But how to get is player wrote right format? not like: qwe, lasds, trt, asdas, sdasd, but hours and minutes: HH:MM .


2.
Код:
new TIMEINTERVALS[ 10 ][ 10 ];
if(sscanf(params, "S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]", 
TIMEINTERVALS[ 0 ],TIMEINTERVALS[ 1 ],TIMEINTERVALS[ 2 ],TIMEINTERVALS[ 3 ],TIMEINTERVALS[ 4 ],TIMEINTERVALS[ 5 ],TIMEINTERVALS[ 6 ],
   TIMEINTERVALS[ 7 ],TIMEINTERVALS[ 8 ],TIMEINTERVALS[ 9 ] );
And for player don't need to write exatly 10 intervals.. he can input just 5 HH:MM, HH:MM,HH:MM, HH:MM,HH:MM . Or how much he want, but no more than 10. In my sscanf, i do it right? because if i check TIMEINTERVALS string if it will be empty (with strcmp), then player don't write more intervals right?
Reply
#2

What bad here?

Код:
if(sscanf(params, "dS(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]
I get empty statement.
Reply
#3

Fixed, just in end where is variables i add ; ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)