long in a TBuf?

Login to reply to this topic.
Fri, 2005-08-05 18:24
Joined: 2005-07-19
Forum posts: 37
I make standard gui application with borland c++ mobile.
Then I want to getAltitude e getLongitude from my motorola a1000 thru AGPS.
The method getAltitude and getLongitude (located in a .dll and .lib in my a1000sdk) return a long value and I'll want to print it to screen.

I put a long value in a TInt32 variables (I name it "longitude").
Then I make TBuf<255> buffer.
And I write this code:
buffer.AppendNum(longitude)
Then I use the CCoeControl method draw in order to print the buffer.

The problem is that the value is incorrect!
Is there a problem with any method, with long format conversion to String?

Sat, 2005-08-06 07:10
Joined: 2003-04-01
Forum posts: 142
Re: long in a TBuf?
the method should work just fne. Are you sure you are getting the value as signed and non-signed, just wondering that it could exxplain the wrong value. You could also try using the RADIX like EHEX on the appendNum function to insert the number in different numbering schemes.

yucca
Sat, 2005-08-06 18:39
Joined: 2005-07-19
Forum posts: 37
Re: long in a TBuf?

I tried TInt32, TInt, TUint but the value that I obtain is


              wrong                  correct

longitude 84917085   rather  37.097466
latitude  222582096  rather  14.152998
Sat, 2005-08-06 18:57
Joined: 2005-03-06
Forum posts: 183
Re: long in a TBuf?
yeah, maybe you should look up the meaning of the word "Integer" first.
The numbers you seem to be dealing with are Real numbers not Integers.

Regards,
Isseyp
Sat, 2005-08-06 19:13
Joined: 2005-07-19
Forum posts: 37
Re: long in a TBuf?
I know the difference between Integer, and Real!! Smiley
I wrong on write 37.xxxx, The point is not pratical!! sorry!

I discover the problem.
My agps api (on motorola a1000) give me a latitude and longitude using arc minutes, but i wanted latitude and longitude in degrees:

Infact If we multiply the wrong value * 0.0166666667 then we obtain correct value!!

       1 arc minutes = 0.0166666667 degree!! Smiley
  • Login to reply to this topic.