I'm really new to C++. I'd like to know how to send command to serial ports.
Im connecting to a uniwell POS machine and I dont know what commands I'll be using. They gave me this serial communication protocol manual with this format.
1.4 Clear All Request
It is always safest to clear all existing report requests before you request the days reports. This is done by sending the following request.
SOH C - A STX 0 1 CR LF ETX BCC
how do you send commands like that to a serial port? I know it would be using a WriteFile command but my concern is the format of the command that I'll be using.. coz I havent received any reply from the POS machine I'm trying to connect.
how to send command to serial ports in C++
You are right that "WriteFile" API would be used for writing data to serial port.
First you have to take the data into the buffer. like
char buffer; memset(buffer,0,256); strcpy(buffer,"SOH C - A STX 0 1 CR LF ETX BCC");