Help on - Char[] comparison with "String text" AND Convert Float to Char[]

Hi All,

I am new to the arduino world and need some help on 2 issues on conversion between data types.

Issue 1. Char[] comparison with a "static string" Issue 2. Convert float to Char[]

ISSUE-1

I have declared

char sms_text[6];

sms_text gets populated with the sms text when the gsm module receives. I want to compare a static string text say "sys" to the sms_text and then accordingly do something.

I have tried using the following

 if (strcmp(sms_text,"sys"==0))
  {
       sms.SendSMS("+123456789", "status sms");
  }

But this is not working. I believe either I am using the wrong function or there are some white space in the sms_text. However when i simply print it on serial monitor it displays 'sys'.

Can you please help me resolve this?

ISSUE 2-

I have float variable which needs to be sent out as sms. Lets say it is

float val=345.67

The syntax of getSMS function is-

SendSMS(char *number_str, char *message_str)

I want to send the SMS and convert the float val into appropriate char* format as specified in the sendSMS function above so it goes through.

Any help is much appreciated!!

Cheers

Issue 1

if (strcmp(sms_text,"sys"==0))Braces in the wrong place

Issue 2

The ftoa() function comes to mind.

Ahh that was right in front of my eyes. Thanks a ton mate. it worked!!!

for issue 2 - ftoa is apparently defunct so i used dtostrf function. it worked too. Thanks again man for the prompt response.

Cheers