Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How To Clear the Serial port buffers & How to execute the commands in Visual C++

66 views
Skip to first unread message

Mani Kumar Yadavalli

unread,
Jul 24, 2013, 8:51:31 AM7/24/13
to
Hi i am developing a windows form application using visual c++ (baudrate=115200)

any one can help me, here is my sample code

****************

private: System::Void button11_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ msg;
if(this->_serialPort->IsOpen)
{
this->_serialPort->Write("iwconfig scan");
this->_serialPort->Write("\r\n");

msg=_serialPort->ReadExisting();
label15->Text=msg;
_serialPort->DiscardInBuffer();
_serialPort->DiscardOutBuffer();

}
}
***************************

my application need to execute the command "iwconfig scan" it will give the list of SSID available......

my problem:

the command is executing only once.. if i click the button again it is not executing the command..

I am trying to clear the buffers.. but _serialPort->DiscardInBuffer();
_serialPort->DiscardOutBuffer(); are not working..

please help me to execute the commands by writing it to serial port and have to read the result of the command from the serial port if click the button.

Any Help/Suggestions are very useful to me.

Thanks & Regards

Mani
0 new messages