Wait for ACK

I am new to the Arduino environment and am trying to talk to a GSM modem using the SoftwareSerial library. The GSM modem gives a number of ACKs back from commands sent to it. I have no problem reading the data received from the GSM modem and all is cool. However, I would like to wait for an ACK after I have sent a command to the GSM modem. For instance: If I send ''AT" then I must wait for "OK" If I send "AT+CREG?" then I must wait for "+CREG:0,1"

Could anyone be of assistance with a code snippet?

Could anyone be of assistance with a code snippet?

You would be better off developing it yourself. You probably want to include a timeout function, so you don't wait forever.

If I send ''AT" then I must wait for "OK" If I send "AT+CREG?" then I must wait for "+CREG:0,1"

I doubt that this is truly correct. The reply is probably more like "OK\n\r" or "+CREG:0,1\n\r".

It is the \n\r that define when the end of a packet has arrived, so that the while loop that is waiting for them can end.

please post the code you have used