<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic problem with building dynamic resbuf list in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993697#M31243</link>
    <description>I'd like to build a dynamic resbuf list, size of which is ranging from 1 to 100, take 4 for example : &lt;BR /&gt;
&lt;BR /&gt;
struct resbuf *rb = acutBuildList(&lt;BR /&gt;
AcDb::kDxfText, GetData(0), // GetData(0) is CString("a")&lt;BR /&gt;
AcDb::kDxfText, GetData(1), // GetData(1) is CString("b")&lt;BR /&gt;
AcDb::kDxfText, GetData(2), // GetData(2) is CString("c")&lt;BR /&gt;
AcDb::kDxfText, GetData(3), // GetData(3) is CString("d")&lt;BR /&gt;
 0);&lt;BR /&gt;
&lt;BR /&gt;
this *rb  is no doubt equal to ("a","b","c","d")&lt;BR /&gt;
&lt;BR /&gt;
I wrote the following code snippet, trying to do the work acutBuildList has done. &lt;BR /&gt;
&lt;BR /&gt;
struct resbuf *pBegin, *pNode, *pPrior;&lt;BR /&gt;
int size = GetArraySize(); // this returns 4&lt;BR /&gt;
pBegin = acutNewRb(AcDb::kDxfText);&lt;BR /&gt;
pBegin-&amp;gt;resval.rstring = GetData(0).GetBuffer(100);&lt;BR /&gt;
pBegin-&amp;gt;rbnext = NULL;&lt;BR /&gt;
pPrior = pBegin;&lt;BR /&gt;
for(int j=1;j&lt;SIZE&gt;
{&lt;BR /&gt;
pNode = acutNewRb(AcDb::kDxfText);&lt;BR /&gt;
pNode-&amp;gt;resval.rstring = GetData(j).GetBuffer(100);&lt;BR /&gt;
pPrior-&amp;gt;rbnext = pNode;&lt;BR /&gt;
pNode-&amp;gt;rbnext = NULL;&lt;BR /&gt;
pPrior = pNode;&lt;BR /&gt;
}&lt;BR /&gt;
return pBegin;&lt;BR /&gt;
&lt;BR /&gt;
However it didn't work correctly, i got ("d","d","d","d") instead of ("a","b","c","d"). Help !&lt;/SIZE&gt;</description>
    <pubDate>Thu, 01 Apr 2004 12:13:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2004-04-01T12:13:29Z</dc:date>
    <item>
      <title>problem with building dynamic resbuf list</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993697#M31243</link>
      <description>I'd like to build a dynamic resbuf list, size of which is ranging from 1 to 100, take 4 for example : &lt;BR /&gt;
&lt;BR /&gt;
struct resbuf *rb = acutBuildList(&lt;BR /&gt;
AcDb::kDxfText, GetData(0), // GetData(0) is CString("a")&lt;BR /&gt;
AcDb::kDxfText, GetData(1), // GetData(1) is CString("b")&lt;BR /&gt;
AcDb::kDxfText, GetData(2), // GetData(2) is CString("c")&lt;BR /&gt;
AcDb::kDxfText, GetData(3), // GetData(3) is CString("d")&lt;BR /&gt;
 0);&lt;BR /&gt;
&lt;BR /&gt;
this *rb  is no doubt equal to ("a","b","c","d")&lt;BR /&gt;
&lt;BR /&gt;
I wrote the following code snippet, trying to do the work acutBuildList has done. &lt;BR /&gt;
&lt;BR /&gt;
struct resbuf *pBegin, *pNode, *pPrior;&lt;BR /&gt;
int size = GetArraySize(); // this returns 4&lt;BR /&gt;
pBegin = acutNewRb(AcDb::kDxfText);&lt;BR /&gt;
pBegin-&amp;gt;resval.rstring = GetData(0).GetBuffer(100);&lt;BR /&gt;
pBegin-&amp;gt;rbnext = NULL;&lt;BR /&gt;
pPrior = pBegin;&lt;BR /&gt;
for(int j=1;j&lt;SIZE&gt;
{&lt;BR /&gt;
pNode = acutNewRb(AcDb::kDxfText);&lt;BR /&gt;
pNode-&amp;gt;resval.rstring = GetData(j).GetBuffer(100);&lt;BR /&gt;
pPrior-&amp;gt;rbnext = pNode;&lt;BR /&gt;
pNode-&amp;gt;rbnext = NULL;&lt;BR /&gt;
pPrior = pNode;&lt;BR /&gt;
}&lt;BR /&gt;
return pBegin;&lt;BR /&gt;
&lt;BR /&gt;
However it didn't work correctly, i got ("d","d","d","d") instead of ("a","b","c","d"). Help !&lt;/SIZE&gt;</description>
      <pubDate>Thu, 01 Apr 2004 12:13:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993697#M31243</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-01T12:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: problem with building dynamic resbuf list</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993698#M31244</link>
      <description>Horace wrote:
&amp;gt; I'd like to build a dynamic resbuf list, size of which is ranging from 1 to 100, take 4 for example : 
&amp;gt; 
&amp;gt; struct resbuf *rb = acutBuildList(
&amp;gt; AcDb::kDxfText, GetData(0), // GetData(0) is CString("a")
&amp;gt; AcDb::kDxfText, GetData(1), // GetData(1) is CString("b")
&amp;gt; AcDb::kDxfText, GetData(2), // GetData(2) is CString("c")
&amp;gt; AcDb::kDxfText, GetData(3), // GetData(3) is CString("d")
&amp;gt;  0);
&amp;gt; 
&amp;gt; this *rb  is no doubt equal to ("a","b","c","d")
&amp;gt; 
&amp;gt; I wrote the following code snippet, trying to do the work acutBuildList has done. 
&amp;gt; 
&amp;gt; struct resbuf *pBegin, *pNode, *pPrior;
&amp;gt; int size = GetArraySize(); // this returns 4
&amp;gt; pBegin = acutNewRb(AcDb::kDxfText);
&amp;gt; pBegin-&amp;gt;resval.rstring = GetData(0).GetBuffer(100);
&amp;gt; pBegin-&amp;gt;rbnext = NULL;
&amp;gt; pPrior = pBegin;
&amp;gt; for(int j=1;j&lt;SIZE&gt; {
&amp;gt; pNode = acutNewRb(AcDb::kDxfText);
&amp;gt; pNode-&amp;gt;resval.rstring = GetData(j).GetBuffer(100);
&amp;gt; pPrior-&amp;gt;rbnext = pNode;
&amp;gt; pNode-&amp;gt;rbnext = NULL;
&amp;gt; pPrior = pNode;
&amp;gt; }
&amp;gt; return pBegin;
&amp;gt; 
&amp;gt; However it didn't work correctly, i got ("d","d","d","d") instead of ("a","b","c","d"). Help !

resval.rstring should hold a copy of the string.  Try this-

pBegin-&amp;gt;resval.rstring = strdup(GetData(0));

pNode-&amp;gt;resval.rstring = strdup(GetData(j));

assuming GetData() returns a CString...

-- 
Best regards,

   Byron Blattel
   CADwerx--Applications for AutoCAD
   Autodesk Registered Developer
   Contact Info @ http://www.cadwerx.net
   Custom Programming Services - ObjectARX/C++/MFC/ASP/STL/ATL/ISAPI...&lt;/SIZE&gt;</description>
      <pubDate>Thu, 01 Apr 2004 13:34:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993698#M31244</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-01T13:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem with building dynamic resbuf list</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993699#M31245</link>
      <description>Hi Byron,&lt;BR /&gt;
&lt;BR /&gt;
Gee, you're right again. Now it works fine. Thanks!!!&lt;BR /&gt;
&lt;BR /&gt;
Horace</description>
      <pubDate>Thu, 01 Apr 2004 14:15:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/problem-with-building-dynamic-resbuf-list/m-p/993699#M31245</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-04-01T14:15:47Z</dc:date>
    </item>
  </channel>
</rss>

