Wait for SMS?

Hi ALL :D

Im having a slight issue with waiting for an SMS to come in, here is the situation, I have my GSM shield and in my programming I would like the user to send a sms before the programming will go any further.

The code below is what i have done, the only problem is that it doesn't wait for the sms to come in. Any help would be appreciated :D

 sms.beginSMS(Cell_num);
    sms.print("Your Pet is looking for food, Reply Y to allow or N to deny");
    sms.endSMS(); 
    lcd.clear();
     if (sms.available())
     {
       if(sms.peek()=='#')
        {
           lcd.println("Discarded SMS");
           sms.flush();
        }
       while(c=sms.read())
       lcd.print(c);
     }
    delay(1000);
    lcd.clear();

The code below is what i have done, the only problem is that it doesn’t wait for the sms to come in.

Where have you told it to?

Like so:

while(sms.available() == 0) {}  // Do nothing until an sms is available

Cool Thanks,

Its working

Regards