Evaluating a String

19 Dec 2010

Can someone tell  me  if  this is a valid (i.e. sensible) statement

if (remote.scanf("%s", remcon)) {
     remaction=atoi(remcon);
  }

I am getting a string  in via the sreial port (not the one connected  to  the USB lines). If  its a valid string,  I  am assuming the statement  evalues as TRUE and I then execute remaction=atoi(remcon).   If  it is  not a string (so no \0 terminator),  I  go an execute the else which is to basically  flush remcon.  I then exit the serial ISR and go back to the main command processing loop.

Any help will be appreciated