Symbian3/SDK/Source/GUID-4F882837-0DA1-5243-BA7B-696B418A160E.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-4F882837-0DA1-5243-BA7B-696B418A160E.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-4F882837-0DA1-5243-BA7B-696B418A160E" xml:lang="en"><title>How to
+use a package buffer</title><shortdesc>Explains how to use <codeph>TPckg&lt; &gt;</codeph>.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>The following code fragments show an object or a C type struct being written
+to a file:</p>
+<codeblock id="GUID-852DE4D2-DF5B-50BD-B347-627809FBFA22" xml:space="preserve">TXxx x;                    // some structure
+TPtr8 xDes(&amp;x, sizeof(x)); // descriptor of that structure
+file.Write(xDes);          // write structure to file</codeblock>
+<p>While this approach works, it is not type safe. The descriptor could be
+mistaken as referring to an object which is not of type <codeph>TXxx</codeph>.</p>
+<p>Use a package buffer which works in a similar way but enforces type safety,
+as the following code fragment shows:</p>
+<codeblock id="GUID-7EBF5473-C9C8-5056-AEFA-6B3CC8822765" xml:space="preserve">TXxx x;                    // some structure
+TPckg&lt;TXxx&gt; xDes(x);       // make into a package
+file.Write(xDes);          // now write structure t file</codeblock>
+</conbody></concept>
\ No newline at end of file