Reading from serial [using VisualStudio, C++ and Arduino SerialClass]

Hi everyone. I use the SerialClass to read from the serial port what Arduino has to say to the world. Arduino writes every second, on the serial, a number in this form: $123* ($391*, $112*, etc.))

I want to read them from VisualStudio using C++. I use the Serial::ReadData to read by, if I try to read 5 bytes ($123*) I never get in the buffer the right data, I always get half of a line and half of the next one (i.e. 3* ? ?$). In the middle I always find the ? symbol that I guess is the newline symbol. How can I read only one line as I can do using the serial monitor in the Arduino IDE?

Thanks in advance. Claudio

Are you using println instead of print? If so, try using print.

Asking questions about code we can not see is silly. Post the code for the Arduino and the C++ program.

The use of print instead of println cleaned the output a lot! Thanks marklar :)

Also check out this .. http://www.arduino.cc/en/Serial/Print You will find that the optional second parameter that specifies the base (format) to use can effect what you are reading on the computer side.

Also - never assume the next 5 bytes will be exactly what you want. You should use some type of delimiter to know you have reached the end of a command.