Convert strings in C++

Hallo

Some help please.

How do I convert

"îfÇÞJwrã;c)¤n;cibK+JcBCbjBJoΈÆçBâÈãNB‡kBH¤î[ÂÆÆF‡JJ©*!÷†K¨J¨)!ÉsââGãCó
¡ˆcCBjCcBBjccBBCcBB)JJ-æÉsârwÆJcBBAJJJCbJJ)JJ)JJ©J¨ÚŸçÎò÷ÃìBCB"

to something understandable.

Story behind the story. Got a GPS unit last year that communicates
through RS232. The input string is the above. I would like to use
the GPS input to set my PC's time - for accurate observations. To do
that I need to extract the time from the input - therefore first need to
deceiver the input.

Basic code snippet to test the GPS unit.

AnsiString comstring;

comstring = MSComm1->Input.VOleStr;

if ( comstring > 1 )
{
Memo1->Lines->Add(comstring);
}

Borland C++ 6.0 - Graphical user environment

Regards
Pat
Well, unless you have the docs it could take some effort...If you are certain the above string contains a time then here goes:

You'd need to get another input string and compare the two to see which bits (!) change.

Try changing the time on the GPS unit as well, add one hour, add one day and see which bits change.

Once you have enough information you can decipher the format.

tbh, that string looks far too long to just contain a time. However, you might be lucky.
I downloaded the user manual for the specific model. The communications code and protocols is very complicated, but I will try to use their specs to deceiver the input.

If I don't figure it out then I'll throw something on the forum again.

One of my friends mentioned that it might be the settings of the Comm control.

Will see what happens.
One of my friends mentioned that it might be the settings of the Comm control.


Tend to agree. The first message is usually to establish the link.
Got the GPS working in Hyper Terminal. Settings. 38400,8,N,1 with Emulation - VT100.

Output:

$GPGRA,22123456,1052255N,4422544E,8,1,1500,0,0,0,0
$GPRMA,22123456,456,223,23,1,1,0,0,0
.
.
.
.etc

The problem is that in C++ I still struggle with the data input - at the new settings. I have a problem converting the ASCII input correctly.

Q! What is the best and easiest way to convert an incoming string of ASCII characters to a string value. I have another app that controls a filter-wheel, and the positions are set by passing 251-259 to the controller, but I had to use the physical AnsiString value through the MSComm->Output for the system to work.

I know that by type casting the input value as int(input) it gives the correct integer value, but what is the reverse??

Don't work with characters that much.

Pat
Topic archived. No new replies allowed.