diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-4F882837-0DA1-5243-BA7B-696B418A160E.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-4F882837-0DA1-5243-BA7B-696B418A160E.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,26 @@ + + + + + +How to +use a package bufferExplains how to use TPckg< >. +

The following code fragments show an object or a C type struct being written +to a file:

+TXxx x; // some structure +TPtr8 xDes(&x, sizeof(x)); // descriptor of that structure +file.Write(xDes); // write structure to file +

While this approach works, it is not type safe. The descriptor could be +mistaken as referring to an object which is not of type TXxx.

+

Use a package buffer which works in a similar way but enforces type safety, +as the following code fragment shows:

+TXxx x; // some structure +TPckg<TXxx> xDes(x); // make into a package +file.Write(xDes); // now write structure t file +
\ No newline at end of file