Serial communication-MSComm control in VC++

I am using MSComm control in VC++. I could write a data into the port . But according to my project 5 bytes should arrive to PC. but when i say
it is returning a bstr which contains only one byte of data of length 1. But the same is perfectly working in VB. I could'nt trace out where is the problem.
Who is Participating?
orozcoConnect With a Mentor Commented:

You have to declare your a variable as the following:

int CControlComView::ReadCharacter(_bstr_t *a)
  *a = m_MSComm1.GetInput();
  return a->length();

you don't have to declare "a" as a variant.

good luck.
Does the data contain embedded null characters ('\0')? The mscomm class does not handle those; instead it terminates the string returned there.
karthik1979Author Commented:
out of 5 bytes 1 and 5th byte are same .they resemble a special character which appear as letter I in bold
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.