<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - How to write in a file - Comments</title>
 <link>http://www.newlc.com/forum/how-write-file-0</link>
 <description>Comments for &quot;How to write in a file&quot;</description>
 <language>en</language>
<item>
 <title>Re: How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0#comment-45475</link>
 <description>&lt;p&gt;To write to file TDes16 using RFileWriteStream you can use following code&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;void WriteToFile (TDesC &amp;amp;aFileName, TDes &amp;amp;aBuf)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RFs fs;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RFileWriteStream file;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.Connect ();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CleanupClosePushL (fs);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (file.Open (fs, aFileName, EFileWrite) != KErrNone)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CleanupStack::PopAndDestroy ();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CleanupClosePushL (file);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.WriteL (aBuf);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CleanupStack::PopAndDestroy (2);&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
But be aware as this code do not appen but write to the  file at offset 0 each time it is called.&lt;br /&gt;
You can use RFile::Open,  RFile::Seek to specify the offset you want to write to and then use RFileWriteStream::Attach to attach write stream to your file...&lt;/p&gt;</description>
 <pubDate>Tue, 01 Apr 2008 09:37:05 +0200</pubDate>
 <dc:creator>dvoid</dc:creator>
 <guid isPermaLink="false">comment 45475 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0#comment-45472</link>
 <description>&lt;p&gt;&lt;/p&gt;

&lt;p&gt;thank u..&lt;/p&gt;

&lt;p&gt; if i want to append... i want to use RFileReadStream/RFileReadStream as i want to write TDes16 data to a file...&lt;/p&gt;

&lt;p&gt;can u give me small sample code as above....&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Tue, 01 Apr 2008 09:13:06 +0200</pubDate>
 <dc:creator>cholker</dc:creator>
 <guid isPermaLink="false">comment 45472 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0#comment-45471</link>
 <description>&lt;p&gt;Your code willl be something like this:&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;void SaveToFile (TDesC &amp;amp;aFileName, TDes8 &amp;amp;aBuf)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RFs fs;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RFile file;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.Connect ();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (file.Create (fs, aFileName, EFileWrite | EFileShareAny) != KErrNone)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.Close ();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.Write (aBuf);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.Close ();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.Close ();&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;</description>
 <pubDate>Tue, 01 Apr 2008 09:08:52 +0200</pubDate>
 <dc:creator>dvoid</dc:creator>
 <guid isPermaLink="false">comment 45471 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0#comment-45435</link>
 <description>&lt;p&gt;Check for RFs and RFile APIs.&lt;/p&gt;</description>
 <pubDate>Mon, 31 Mar 2008 05:20:51 +0200</pubDate>
 <dc:creator>SymbianReady</dc:creator>
 <guid isPermaLink="false">comment 45435 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0#comment-45431</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/topic-567&quot;&gt;http://www.newlc.com/topic-567&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;above might give you some clue.  Please search in this forum. You will get lot of code snippets.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;</description>
 <pubDate>Sun, 30 Mar 2008 19:29:22 +0200</pubDate>
 <dc:creator>83.manish</dc:creator>
 <guid isPermaLink="false">comment 45431 at http://www.newlc.com</guid>
</item>
<item>
 <title>How to write in a file</title>
 <link>http://www.newlc.com/forum/how-write-file-0</link>
 <description>&lt;p&gt;hello,&lt;br /&gt;
  i  have created an HBuf* xyz...&lt;/p&gt;

&lt;p&gt;n i have to write its content to a file, every time i need to append the content in my file... can &lt;br /&gt;
any one tell me hw can i do it ..&lt;br /&gt;
can any one give me small sample code...&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/forum/how-write-file-0&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/forum/how-write-file-0#comments</comments>
 <category domain="http://www.newlc.com/forums/symbian-c">Symbian C++</category>
 <pubDate>Sun, 30 Mar 2008 11:07:17 +0200</pubDate>
 <dc:creator>cholker</dc:creator>
 <guid isPermaLink="false">20591 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
