Binary data with MSComm control in VC++

Posted on 2000-02-09
Medium Priority
Last Modified: 2013-12-03
I need to recieve binary data with an MSComm communications control in VC++ 6.0 with MFC. I know that in VB you can set the InputMode property to binary but I can't find any way to do this in C. The problem is that my data contains bytes with the value zero and input is a string so a zero byte terminates the string.
Question by:airek
  • 2
LVL 15

Accepted Solution

NickRepin earned 600 total points
ID: 2505921
You have to pass the string length to VC as well.
LVL 15

Expert Comment

ID: 2505965
C strings can contain zeroes inside. But to work with such string, you have to know its length.

Then you can, for example, print the string contents as hex data:

 printf("%02X, ",(int) String[i]);

But you cannot use such string in


because only initial part of the string, terminated by zero, will be printed.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question