Hi does anyone here know how to read from a serial port using c++?

I just got this got from the internet but it doesnt work:

CSerial serial;
if (serial.Open(2, 9600))
AfxMessageBox("Port opened successfully");
else
AfxMessageBox("Failed to open port!");