using descriptor in struct....
| Fri, 2006-01-20 17:16 | |
|
Hello,
I want to use a descriptor inside a structure. For example I have : in a header file ............... struct TTest { TInt iInteger; const TDesC* iDescriptor; // is this ok to use? // HBufC* iDescriptor; }; ................... My question is how can I use a descriptor for wich I don't know the exact length? class CStructTest { CStructTest(TTest& aTest); ........... TTest& iTest; }; CStructTest::CStructTest(TTest& aTest):iTest(aTest) { } |
|






Forum posts: 364
1) You can't use a TDesC*, TDesCs are abstract classes and you can't declare one like that(you only see them used in function declarations)
2) Instead you would declare a TBuf<X> if you know the size of string you want, or a HBuf if you want to grow the string dynamically.
3) HBuf's allocate their memory on the heap and thus you can't put one inside a struct because a struct is a T object and if you are using a heap based object you have to use a C object.