PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

TBuf<TInt> and CGapiSurface.DrawText on Symbian

Hi
I'm still trying to sort my highscore file problem on Symbian!!
I use the nokia sdk for series 60 and GD 3.00.
Thanks to jonasb I found a good base to work on on NewLc site.

I still have a tiny problem:
the fonction LoadScore returns the name as a TBuf<15> and I want to display it using DrawText. So I need to convert it to a TCHAR *.
I tried to use
name.Ptr() which should return a pointer to the data (exactly what I need) but only the first letter is displayed!!!
Do I miss something obvious?
Please help me!!!

Vincent.
sasa · 06 May 2004, 08:22 UTC — In case you didn't find a solution for your problem
TBuf<15> is a pointer to TUint16 and TEXT is array of TUint8. So you should do something like this:

Code:


TUint16 *uiPtr16 = buf15.Ptr();
TUint8 *uiPtr8 = new TUint8[15];
wcstombs(uiPtr8, uiPtr16, 15);



I assumed that your TBuf<15> variable is buf15. Now you can do DrawText(..., uiPtr8,...).

The problem was in that TUint16* pointer which was returned from buf15.Ptr(). You received only the first letter because in upper byte of your TUint16* was a "0" which terminated string (null terminated string).

I hope this will help you.
vince_mad · 06 May 2004, 12:58 UTC — many thanks
Hi
Many thanks for your reply but I finally changed my mind and used basic C fopen, fwrite... stuff.
Anyway this may help for the future...

Vincent.