Reading serial data into a C++ program. Data is odd characters but after opening a serial connection in XCTU it works?

I am sending data between an XBee transceiver and my pc.
The issue is that, initially (in my program) the data is random characters. Only after opening and closing a serial connection in XCTU does it work.
So the serial data is being sent correctly, but XCTU does something to synchronise my pc to the XBee. Baud rates are set at 9600 both sides.

Does anybody know what XCTU is doing? Or how I can replicate it within my C++ program?

Hopefully the image below explain what is happening more clearly.
Image to further explain what’s happening