<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Introducing PStrings</title>
	<atom:link href="http://arduiniana.org/2009/02/pstring/feed/" rel="self" type="application/rss+xml" />
	<link>http://arduiniana.org/2009/02/pstring/</link>
	<description>Arduino wisdom and gems by Mikal Hart</description>
	<lastBuildDate>Thu, 02 Feb 2012 11:22:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mikal</title>
		<link>http://arduiniana.org/2009/02/pstring/comment-page-1/#comment-134</link>
		<dc:creator>Mikal</dc:creator>
		<pubDate>Thu, 25 Jun 2009 19:49:27 +0000</pubDate>
		<guid isPermaLink="false">http://sundial.org/arduino/?p=187#comment-134</guid>
		<description>Hmmm...

Could you try printing each character individually, something like

&lt;pre&gt;for (int i=0; i&lt;16; ++i)
{
  Serial.print(ShotString[i], BYTE);
  Serial.print(&quot; &quot;);
  Serial.println(ShotString[i], DEC);
}&lt;/pre&gt;

?

I wonder if somehow some null bytes are getting embedded into the string.

Mikal</description>
		<content:encoded><![CDATA[<p>Hmmm&#8230;</p>
<p>Could you try printing each character individually, something like</p>
<pre>for (int i=0; i&lt;16; ++i)
{
  Serial.print(ShotString[i], BYTE);
  Serial.print(" ");
  Serial.println(ShotString[i], DEC);
}</pre>
<p>?</p>
<p>I wonder if somehow some null bytes are getting embedded into the string.</p>
<p>Mikal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joachim</title>
		<link>http://arduiniana.org/2009/02/pstring/comment-page-1/#comment-133</link>
		<dc:creator>Joachim</dc:creator>
		<pubDate>Thu, 25 Jun 2009 08:29:37 +0000</pubDate>
		<guid isPermaLink="false">http://sundial.org/arduino/?p=187#comment-133</guid>
		<description>Hi again,

Now that worked in the example code, but not in my large code. I&#039;m using IDE 16 and a 2009 328. I&#039;ll have to look for what is different. Thanks again.

PS, here&#039;s what the outcome is:

ShotString:  0

Size  16


Joachim</description>
		<content:encoded><![CDATA[<p>Hi again,</p>
<p>Now that worked in the example code, but not in my large code. I&#8217;m using IDE 16 and a 2009 328. I&#8217;ll have to look for what is different. Thanks again.</p>
<p>PS, here&#8217;s what the outcome is:</p>
<p>ShotString:  0</p>
<p>Size  16</p>
<p>Joachim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikal</title>
		<link>http://arduiniana.org/2009/02/pstring/comment-page-1/#comment-132</link>
		<dc:creator>Mikal</dc:creator>
		<pubDate>Thu, 25 Jun 2009 08:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://sundial.org/arduino/?p=187#comment-132</guid>
		<description>Well, it&#039;s not heroic if it doesn&#039;t work! :&#124;

Just to clarify, does the Serial.println line print nothing or &quot;0&quot;?  What version of Arduino?  Can you try deleting PString.o to make sure you are getting the library recompiled?  I would expect that to work.  Yes, you should use begin() if you intend to reuse/reset the string object.  Perhaps try a simpler example like

mystring.print(&quot;test&quot;);
Serial.println(ShotString);

?

Mikal</description>
		<content:encoded><![CDATA[<p>Well, it&#8217;s not heroic if it doesn&#8217;t work! <img src='http://arduiniana.org/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </p>
<p>Just to clarify, does the Serial.println line print nothing or &#8220;0&#8243;?  What version of Arduino?  Can you try deleting PString.o to make sure you are getting the library recompiled?  I would expect that to work.  Yes, you should use begin() if you intend to reuse/reset the string object.  Perhaps try a simpler example like</p>
<p>mystring.print(&#8220;test&#8221;);<br />
Serial.println(ShotString);</p>
<p>?</p>
<p>Mikal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joachim</title>
		<link>http://arduiniana.org/2009/02/pstring/comment-page-1/#comment-131</link>
		<dc:creator>Joachim</dc:creator>
		<pubDate>Thu, 25 Jun 2009 06:02:39 +0000</pubDate>
		<guid isPermaLink="false">http://sundial.org/arduino/?p=187#comment-131</guid>
		<description>Hi Mikal,

Once again you&#039;ve solved one of my challenges, writing all sorts of variables to string. But my string turns up empty in Serial.print. Here&#039;s an extract of the code, it&#039;s used to create a string to be written into a memory card to make a csv file:

char ShotString[80];//Buffer string to help write to memory card
PString mystring(ShotString, sizeof(ShotString));

mystring.begin();      //goes to the start of ShotString buffer
  if (day&lt;=9){mystring.print(&quot;0&quot;);}
  mystring.print(day);
  if (month&lt;=9){mystring.print(&quot;0&quot;);}
  mystring.print(month);
  mystring.print(year);
  mystring.print(&quot;,&quot;);
  if (hour&lt;=9){mystring.print(&quot;0&quot;);}
  mystring.print(hour);
  if (minute&lt;=9){mystring.print(&quot;0&quot;);}
  mystring.print(minute);
  mystring.print(&quot;,&quot;);
  mystring.print(ClubSelection);
  mystring.print(&quot;,&quot;);
  mystring.print(shotlength);//  mystring.print(&quot;;&quot;);
  Serial.println(ShotString);//This returns 0, however the length is 16!!

The strange thing is that it compiles fine, and the length may be ok, but the serial sends &quot;0&quot;.

Also, Am I right in starting the string as I have done with begin? If the new string is shorter than the last, will the termination handle that and leave the new string in its correct length?

Thanks again Mikal, you are a real Arduino hero!

Joachim</description>
		<content:encoded><![CDATA[<p>Hi Mikal,</p>
<p>Once again you&#8217;ve solved one of my challenges, writing all sorts of variables to string. But my string turns up empty in Serial.print. Here&#8217;s an extract of the code, it&#8217;s used to create a string to be written into a memory card to make a csv file:</p>
<p>char ShotString[80];//Buffer string to help write to memory card<br />
PString mystring(ShotString, sizeof(ShotString));</p>
<p>mystring.begin();      //goes to the start of ShotString buffer<br />
  if (day&lt;=9){mystring.print(&#8220;0&#8243;);}<br />
  mystring.print(day);<br />
  if (month&lt;=9){mystring.print(&#8220;0&#8243;);}<br />
  mystring.print(month);<br />
  mystring.print(year);<br />
  mystring.print(&#8220;,&#8221;);<br />
  if (hour&lt;=9){mystring.print(&#8220;0&#8243;);}<br />
  mystring.print(hour);<br />
  if (minute&lt;=9){mystring.print(&#8220;0&#8243;);}<br />
  mystring.print(minute);<br />
  mystring.print(&#8220;,&#8221;);<br />
  mystring.print(ClubSelection);<br />
  mystring.print(&#8220;,&#8221;);<br />
  mystring.print(shotlength);//  mystring.print(&#8220;;&#8221;);<br />
  Serial.println(ShotString);//This returns 0, however the length is 16!!</p>
<p>The strange thing is that it compiles fine, and the length may be ok, but the serial sends &#8220;0&#8243;.</p>
<p>Also, Am I right in starting the string as I have done with begin? If the new string is shorter than the last, will the termination handle that and leave the new string in its correct length?</p>
<p>Thanks again Mikal, you are a real Arduino hero!</p>
<p>Joachim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Albert</title>
		<link>http://arduiniana.org/2009/02/pstring/comment-page-1/#comment-66</link>
		<dc:creator>Albert</dc:creator>
		<pubDate>Fri, 15 May 2009 21:13:55 +0000</pubDate>
		<guid isPermaLink="false">http://sundial.org/arduino/?p=187#comment-66</guid>
		<description>Dear Mikal,

I have some improvements for the Flash, PString and Streaming libraries and I found some minor bugs. Look for *Albert in the files for the changes. You can find my files here: http://www.esnips.com/web/Arduino/

test_pstring.pde
1. I added a streaming example.
2. Other &quot;quickie&quot; examples: There is a bug, the first 2 lines don’t work.

I was looking for a method to get rid of the sizeof(buffer) in de constructor but I am afraid that this is not possible.

I send you the other files soon.
Yours sincerely,
Albert</description>
		<content:encoded><![CDATA[<p>Dear Mikal,</p>
<p>I have some improvements for the Flash, PString and Streaming libraries and I found some minor bugs. Look for *Albert in the files for the changes. You can find my files here: <a href="http://www.esnips.com/web/Arduino/" rel="nofollow">http://www.esnips.com/web/Arduino/</a></p>
<p>test_pstring.pde<br />
1. I added a streaming example.<br />
2. Other &#8220;quickie&#8221; examples: There is a bug, the first 2 lines don’t work.</p>
<p>I was looking for a method to get rid of the sizeof(buffer) in de constructor but I am afraid that this is not possible.</p>
<p>I send you the other files soon.<br />
Yours sincerely,<br />
Albert</p>
]]></content:encoded>
	</item>
</channel>
</rss>

