read floats from serial (polhemus fastrak)

Hello. I have been trying to read some floats off a polhemus tracker for a
good week now. I'm just about ready to give up.
I would really really appreciate any help in solving this as it has consumed
an entire week of my life :)
An example of the floats I'm trying to read are displayed in this image.
It's the data that I see when I open a terminal to it.
http://www.rci.kutc.kansai-u.ac.jp/problem.png
Based on an example i found on the net I put together a class as such:
*class minicom_client *
*{ *
*public: *
* minicom_client(boost::asio::io_service& io_service, unsigned int
baud, const std::string& device, EventQueue* queue) *
* : serialPort(io_service, device), eventQueue(queue) *
* { *
* **if (!serialPort.is_open()) *
* { *
* MessageBox(NULL,"Serial Port","Failed to
open",MB_OK);*
* return; *
* } *
* boost::asio::serial_port_base::baud_rate
baud_option(baud); *
* serialPort.set_option(baud_option);*
* *
* **std::string msg = "fC"; **//command to get the tracker to start
sending us binary output continuously*
*
*
* **boost::asio::write(serialPort,boost::asio::buffer(msg.c_str(),msg.size()));
*//send the command
* *
* ** *//start reading for input
* **serialPort.async_read_some(boost::asio::buffer(buffer, max_read_length),
boost::bind(&minicom_client::read_complete, *
* this, *
* boost::asio::placeholders::error, *
*
boost::asio::placeholders::bytes_transferred)); *
* *
* } *
* *
*private:*
* **void read_complete(const boost::system::error_code& error, size_t
bytes_transferred) *
* **{** *
* **boost::array
participants (1)
-
Jubei