C ++ - serial port control - code will not compile

I am trying to highlight an LED connected to a serial port. I followed the walkthrough that can be found here here . I followed the directions exactly, but I could not compile the code. From the PDF manual, this is part 2, which does not compile, which I reproduce here:

//<Set serial port parameters>

  DCB dcbSerialParams = {0};
  dcbSerial.DCBlength=sizeof(dcbSerialParams);
  if (!GetCommState(hSerial, &dcbSerialParams))
  {
  //error getting state
  }
  dcbSerialParams.BaudRate=CBR_19200;
  dcbSerialParams.ByteSize=8;
  dcbSerialParams.StopBits=ONESTOPBIT;
  dcbSerialParams.Parity=NOPARITY;
  if(!SetCommState(hSerial, &dcbSerialParams))
  {
  //error setting serial port state
  }

//</Set serial port parameters>

I included in the specified code, but I got the error message `` dcbSerial "uneclared (use this function first)." I am using Dev-C ++.

, , , , , , ( - , , ).

.

+3
3

dcbSerial dcbSerialParams.

0
dcbSerial.DCBlength=sizeof(dcbSerialParams);

:

dcbSerialParams.DCBlength=sizeof(dcbSerialParams);

, - , .

+2

dcbSerialParams, dcbSerial

DCB dcbSerialParams = {0};
dcbSerial.DCBlength=sizeof(dcbSerialParams);
0

All Articles