<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — prefix a leading zero to a char variable]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=1529</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1529&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in prefix a leading zero to a char variable.]]></description>
		<lastBuildDate>Thu, 18 Aug 2022 12:30:33 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4770#p4770</link>
			<description><![CDATA[<div class="quotebox"><cite>remotexy wrote:</cite><blockquote><div class="codebox"><pre><code>struct {
    // output variables
  char minutes_run[4];  // string UTF8 end zero 
  char seconds_run[4];  // string UTF8 end zero 
} RemoteXY;

sprintf (RemoteXY.minutes_run, &quot;%02d&quot;, minutes_run);
sprintf (RemoteXY.seconds_run, &quot;%02d&quot;, seconds_run);</code></pre></div><p>minutes_run and seconds_run is a text string</p></blockquote></div><p>Thank you : working well ....</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Thu, 18 Aug 2022 12:30:33 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4770#p4770</guid>
		</item>
		<item>
			<title><![CDATA[Re: prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4769#p4769</link>
			<description><![CDATA[<div class="codebox"><pre><code>struct {
    // output variables
  char minutes_run[4];  // string UTF8 end zero 
  char seconds_run[4];  // string UTF8 end zero 
} RemoteXY;

sprintf (RemoteXY.minutes_run, &quot;%02d&quot;, minutes_run);
sprintf (RemoteXY.seconds_run, &quot;%02d&quot;, seconds_run);</code></pre></div><p>minutes_run and seconds_run is a text string</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Thu, 18 Aug 2022 08:27:25 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4769#p4769</guid>
		</item>
		<item>
			<title><![CDATA[Re: prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4767#p4767</link>
			<description><![CDATA[<div class="quotebox"><cite>remotexy wrote:</cite><blockquote><p>For example<br /></p><div class="codebox"><pre><code>  void writeTime () {
    uint32_t d = millis();
    long ds = d/1000;
    long dm = d%1000;
    char s[15];
    sprintf (s, &quot;[%5ld.%03ld] &quot;,ds, dm);       
    serial-&gt;println ();    
    serial-&gt;print (s);
  }</code></pre></div></blockquote></div><p>Very good, but that doesn&#039;t help me to add leading zeroes to the RemoteXY structure members of my original post ...</p><p>To be honest, I get confused between char[] and string variables, and when to use, and when not to use, I guess I need to watch some good tutorials...</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Mon, 15 Aug 2022 22:29:44 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4767#p4767</guid>
		</item>
		<item>
			<title><![CDATA[Re: prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4765#p4765</link>
			<description><![CDATA[<p>For example<br /></p><div class="codebox"><pre><code>  void writeTime () {
    uint32_t d = millis();
    long ds = d/1000;
    long dm = d%1000;
    char s[15];
    sprintf (s, &quot;[%5ld.%03ld] &quot;,ds, dm);       
    serial-&gt;println ();    
    serial-&gt;print (s);
  }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Mon, 15 Aug 2022 18:57:55 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4765#p4765</guid>
		</item>
		<item>
			<title><![CDATA[Re: prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4762#p4762</link>
			<description><![CDATA[<p>I suppose I should have said char[] array variable, rather than just a single char.</p><p>But never mind, I&#039;ve decided to not display the seconds and minutes of my run_time, just the hours, so the problem (for now) has gone away.</p><p>I&#039;m certain I&#039;ll be able to figure it out if I need to do it in the future, but it would sure be nice if there was a time display library, not found one yet.</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Sat, 13 Aug 2022 20:30:58 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4762#p4762</guid>
		</item>
		<item>
			<title><![CDATA[prefix a leading zero to a char variable]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=4761#p4761</link>
			<description><![CDATA[<p>I want to display the following data with a leading zero if the value is less than 10.</p><div class="codebox"><pre><code>  value = minutes_run; 
  dtostrf(value, 2, 0, RemoteXY.minutes_run);  
  value = seconds_run; 
  dtostrf(value, 2, 0, RemoteXY.seconds_run);  </code></pre></div><p>I&#039;m having a mind-melt on how best to do it, I know it should be straightforward enough surely ...</p><p>Can anyone help, I&#039;m running out of time on this project ....</p>]]></description>
			<author><![CDATA[null@example.com (Daba)]]></author>
			<pubDate>Fri, 12 Aug 2022 14:26:25 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=4761#p4761</guid>
		</item>
	</channel>
</rss>
