hPort = CreateFile (TEXT("COM1:"), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
WriteFile (hPort, szSend, strlen(szSend), &dwWriten, 0); // send to serial. pay attention into what you want to send.
// if the data has a null in the middle, you cannot use strlen to return the length.
ReadFile (hPort, &szCommBuffer, 10, &dwRead, NULL); // read 10 bytes from
CloseHandle (hPort);
Is that what you need?
|