Author Topic: Error by Read  (Read 2150 times)

somnomedics

  • Newbie
  • *
  • Posts: 1
    • View Profile
Error by Read
« on: December 15, 2009, 02:48:05 pm »
My code:

void __fastcall TForm1::nrBT1Connect(TObject *Sender)  // OnConnect event
{
  if(nrBT1->DeviceIndex >= 0)
  {
    if(nrBT1->WaitForBytes(10,5000))
    {
      char buf[20];
      int i=nrBT1->ReadyForRead;  // ReadyForRead is 14
      nrBT1->Read(buf,i); // <---  error   "AccessViolation. Write of address 000000E.
    }
  }
}

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Error by Read
« Reply #1 on: December 15, 2009, 07:10:57 pm »
Hello

Yes you are right. It is a bug. We will fix it in the new version.

Now you can access to incoming data in OnAfterReceive event handler only.

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.