Symbian3/SDK/Source/GUID-1F68D172-1090-5930-BD7B-AE7276667104.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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-1F68D172-1090-5930-BD7B-AE7276667104"><title>How to create streams</title><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Write streams</title> <p>The following code fragment shows how a write stream is created. A write stream is represented by an instance of the <codeph>RStoreWriteStream</codeph> class and an object of this type can be created on the program stack.</p> <p>Use the <codeph>CreateL()</codeph> or <codeph>CreateLC()</codeph> member function of <codeph>RStoreWriteStream</codeph> to create a new stream in a store and return its stream ID.</p> <codeblock id="GUID-959ABC13-9EFE-5CD5-834E-DE744E1D506B" xml:space="preserve">...
RStoreWriteStream outstream;
TStreamId id = outstream.CreateLC(*store);
...
CleanupStack::PopAndDestroy();
...</codeblock> <p><codeph>store</codeph> is a pointer to an already opened stream store.</p> <p>Some stores allow their existing streams to be modified, for example, by overwriting or appending. To open an existing stream for overwriting, use <codeph>OpenL()</codeph> or <codeph>OpenLC()</codeph> and identify both the store and the stream:</p> <codeblock id="GUID-3815630B-ADCE-5251-8283-CF4488C9E2BF" xml:space="preserve">...
RStoreWriteStream outstream;
TStreamId id;
...
outstream.CreateLC(*store,id);
...
CleanupStack::PopAndDestroy();
...</codeblock> <p>In this code fragment, the id of the stream must be known before calling <codeph>CreateLC()</codeph>.</p> <p>Note that not all store types support the modification of existing streams. An attempt to open an existing stream for modification for these store types will <i>fail</i>. A direct file store is an example of a store which does <i>not</i> support the modification of existing streams. </p> </section> <section><title>Read streams</title> <p>The following code fragment shows how a read stream is created. A read stream is represented by an instance of the <codeph>RStoreReadStream</codeph> class and an object of this type can be created on the program stack.</p> <p>Use the <codeph>OpenL()</codeph> or <codeph>OpenLC()</codeph> member function of <codeph>RStoreReadStream</codeph> to open a stream for reading.</p> <codeblock id="GUID-DD8E19E5-0478-53D1-B370-9DA0E838B84F" xml:space="preserve">RStoreReadStream instream;
TStream id;
...
instream.OpenLC(*store,id);
...</codeblock> <p><codeph>store</codeph> is a pointer to an already opened stream store.</p> <p><codeph>id</codeph> identifies the stream to be opened.</p> </section> </conbody></concept>