problem in coding for GSM interfacing using serial port

i am having some coding problem in c for interfacing the GSM module through serial port. i want to send/receive sms. i have done all the setting for the port and know the AT command to use in this but i am actually having problem in reading and writing from serial port how to handle the signal when a msg is received and to send the AT command to the GSM kit.
i need coding for reading and writing the the serial port, and how to send the AT command to the kit.:confused:

There's actually a lot of it on the web.
I recently wrote an SMS handler for a GSM system, and the only bad part about it is the way you send the SMS (the > prompt is stupid).