Talking to the comm port in Windows you should use the winsock.h library.
Nope. winsock library is for socket programming, not RS232 serial port programming.
In linux the procedure for writing to the port is exactly the same as writing to a file.
Similar for win32. CreateFile() to open the comm port, then ReadFile() and WriteFile() to read/write to it.