<?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 - Faulty [] operator on TBuf in 3rd Edition - Comments</title>
 <link>http://www.newlc.com/topic-17233</link>
 <description>Comments for &quot;Faulty [] operator on TBuf in 3rd Edition&quot;</description>
 <language>en</language>
<item>
 <title>Re: Faulty [] operator on TBuf in 3rd Edition</title>
 <link>http://www.newlc.com/topic-17233#comment-36636</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Whooooops!&amp;nbsp; &amp;nbsp;&lt;img src=&quot;/sites/all/modules/smf_filter/smf_smileys/embarassed.gif&quot; alt=&quot;Embarassed&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;&lt;br /&gt;I stand corrected.&amp;nbsp; It never worked on 2nd edition.&amp;nbsp; This whole time I thought that a TBuf was an array.&amp;nbsp; My bad.&lt;br /&gt;&lt;br /&gt;It turns out that while stress testing the application something happened which never happened in the 2nd edition.&lt;br /&gt;&lt;br /&gt;-euroq&lt;/div&gt;</description>
 <pubDate>Thu, 04 Jan 2007 21:19:14 +0100</pubDate>
 <dc:creator>euroq</dc:creator>
 <guid isPermaLink="false">comment 36636 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Faulty [] operator on TBuf in 3rd Edition</title>
 <link>http://www.newlc.com/topic-17233#comment-36635</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;TBuf&amp;lt;32&amp;gt; buf;&lt;br /&gt;buf[0] = &amp;#039;A&amp;#039;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// will cause USER 9 because buf&amp;#039;s length is 0&lt;br /&gt;&lt;br /&gt;I&amp;#039;d be very surprised if this code behaves differently on S60 second edition. The behaviour here was determined a very long time ago (EPOC ER5 and earlier I&amp;#039;m sure)&lt;br /&gt;&lt;br /&gt;A newly created TBuf is empty, so it doesn&amp;#039;t have any elements to access. It has always been this way. Are you absolutely sure that you are not getting a panic on S60 V2?&lt;br /&gt;&lt;/div&gt;</description>
 <pubDate>Wed, 03 Jan 2007 21:13:44 +0100</pubDate>
 <dc:creator>fig7</dc:creator>
 <guid isPermaLink="false">comment 36635 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Faulty [] operator on TBuf in 3rd Edition</title>
 <link>http://www.newlc.com/topic-17233#comment-36634</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Actually, aFileName was usually of length 10 or so.&amp;nbsp; The problem is that you simply can&amp;#039;t do this:&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;TBuf&amp;lt;32&amp;gt; buf;&lt;br /&gt;buf[0] = &amp;#039;A&amp;#039;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// will cause USER 9 because buf&amp;#039;s length is 0&lt;br /&gt;&lt;/div&gt;On 2nd edition, that code would work; on 3rd edition, I&amp;#039;m presuming that the operator[] has changed its connotation to be used as an &lt;i&gt;accessor&lt;/i&gt; instead of a &lt;i&gt;modifier&lt;/i&gt;.&amp;nbsp; For anotherwords, I presume this will work on the 3rd edition:&lt;br /&gt;&lt;div class=&quot;codeheader&quot;&gt;Code:&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;TBuf&amp;lt;32&amp;gt; buf;&lt;br /&gt;buf = _L(&amp;quot;ABC&amp;quot;);&lt;br /&gt;TChar c = buf[0];&amp;nbsp; &amp;nbsp; // length of buf is 3, so buf[0] works&lt;br /&gt;buf[0] = &amp;#039;A&amp;#039;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// now this works because length is 3&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Wed, 03 Jan 2007 16:38:23 +0100</pubDate>
 <dc:creator>euroq</dc:creator>
 <guid isPermaLink="false">comment 36634 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Faulty [] operator on TBuf in 3rd Edition</title>
 <link>http://www.newlc.com/topic-17233#comment-36633</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;&lt;b&gt;USER 9&lt;/b&gt;, if anIndex is negative or is greater than or equal to the current length of this descriptor.&lt;/div&gt;&lt;br /&gt;Now check your for loop: it&amp;#039;s &lt;b&gt;&lt;i&gt;i = 0; i &amp;lt;= strlen(aFileName)&lt;/i&gt;&lt;/b&gt; so that means in this case 0 - 32, right. &lt;br /&gt;&lt;br /&gt;Now see this SDK Help:&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;&lt;b&gt;TInt anIndex &lt;/b&gt;The position the data item within this descriptor&amp;#039;s data. This is an offset value; a zero value refers to the leftmost data position.&lt;/div&gt;&lt;br /&gt;So I think anIndex is becoming &lt;b&gt;greater than the current length of this descriptor&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;try changing the for loop to: &lt;b&gt;i = 0; i &amp;lt; strlen(aFileName);&lt;/b&gt; may work.&lt;/div&gt;</description>
 <pubDate>Wed, 03 Jan 2007 05:43:00 +0100</pubDate>
 <dc:creator>vin2ktalks</dc:creator>
 <guid isPermaLink="false">comment 36633 at http://www.newlc.com</guid>
</item>
<item>
 <title>Faulty [] operator on TBuf in 3rd Edition</title>
 <link>http://www.newlc.com/topic-17233</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/topic-17233&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/topic-17233#comments</comments>
 <category domain="http://www.newlc.com/forums/symbian-c">Symbian C++</category>
 <pubDate>Tue, 02 Jan 2007 23:50:57 +0100</pubDate>
 <dc:creator>euroq</dc:creator>
 <guid isPermaLink="false">16781 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
