I use library coded in plain C. It uses char* strings. How shall I convert char* in symbian descriptors and back. I read topics about 8 and 16 bits descriptors but i suspect that char* and 8 bit one are not the same.
I didnt get exactly what type of conversion u r speaking about. Regarding the descriptors you can use them directly except the abstract classes TDes and TBufcBase. U have to include the corressponding header file and lib file. For eg. #include <e32std.h> _LIT16(KData,"abcdefg"); TBufC16<8> str(KData); TBufC16<8> str2; str2.Copy(str); etc....
and include the lib file euser.lib in the .mmp file. I think this is what u were looking for..........
For const char* you can use TPtrC and for char[] you can use TBufC.
you can go through this link, u will get a better idea.
http://www.newlc.com/article.php3?id_article=12&var_recherche=buffer+descriptors
Forum posts: 364
C code will run if linked against the stdlib
Forum posts: 25
Regarding the descriptors you can use them directly except the abstract classes TDes and TBufcBase. U have to include the corressponding header file and lib file.
For eg.
#include <e32std.h>
_LIT16(KData,"abcdefg");
TBufC16<8> str(KData);
TBufC16<8> str2;
str2.Copy(str);
etc....
and include the lib file euser.lib in the .mmp file.
I think this is what u were looking for..........
Forum posts: 4
I used the following when converting a C string (const char*) to a Symbian descriptor:
TPtrC8 ptr(fromStr);
HBufC8* destBuf = HBufC8::NewLC( strlen(aCString) );
TPtr8 dest(destBuf->Des());
dest.Copy(ptr);
It works for me.
Forum posts: 9
TBuf8<128> buf;
_LIT8(KConnIsNull, "Conn is NULL. SQLError is (%d)");
buf.Format( KConnIsNull, my_Sqlca.GetSQLCode() );
the_ported_function( buf.PtrZ() );
where the_ported_function() has the signature: the_ported_function(char *str);
Hope this helps,
mG.