Serial communication diagnostic application

Hi to all,

I m the beginner in Linux. I would like to write the dignostic
application in c on the Linux OS. Please let me the pocedure to test
the serial port like how to detect the serial port, how to write some
data to the serial port, how to read the data from the serial port.
Previously i was working on WinCE 5.0 PB. There i follow the same steps
to test the functionality of the serial port. Please let me whether it
is possible to follow the same procedure like detect, write and read
while wrking on the linux.Please tell me the code for testing the
funcionality of the srial port.

Please guide me....

Thanks in advance...