di ako gaanong familiar sa c++ but the idea is similar to reading a text file. Instead of the file, you are reading the device name ng com port. Sa linux is more like reading /dev/ttyS01 so I think may equivalent yan sa windows like reading com1:
Ang alam ko may mga libraries kang pwedeng ma download for reading/writing to serial devices. Pwede mo gamitin yun. I google mo na lang.