Symbian3/SDK/Source/GUID-E79D47D6-3FF2-5858-B092-29D39A1CA2B6.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?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 xml:lang="en" id="GUID-E79D47D6-3FF2-5858-B092-29D39A1CA2B6"><title>How to commit streams</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>Once data has been externalised to a stream, an application <i>must</i> commit a stream before disposing of the write stream object.</p> <p>This is done by calling <codeph>CommitL()</codeph> on the write stream object. The function itself is a member of the write stream interface class, <codeph>RWriteStream</codeph>.</p> <p>The following example code fragment shows this:</p> <codeblock id="GUID-CB6C4242-D85C-5C8D-BA42-B27E3178E342" xml:space="preserve">...
TSimple thesimple;
...
...              // Construct a TSimple object
...
RStoreWriteStream outstream;
TStreamId id = outstream.CreateLC(*store);
                 // Externalize the TSimple object
outstream  &lt;&lt; thesimple;
                 // Commit changes to the stream
outstream.CommitL();
                 // Cleanup the stream object
CleanupStack::PopAndDestroy();
...</codeblock> <p><codeph>store</codeph> is a pointer to an already opened stream store.</p> <p>As a simple rule, <codeph>CreateL()</codeph> or <codeph>CreateLC()</codeph> is matched by a call to <codeph>CommitL()</codeph>. More generally, any change to a stream, either the creation of a new one or a change to an existing one, should be matched by a call to <codeph>CommitL()</codeph>.</p> </conbody></concept>