user21651: So I have a Bunch of commonly used char arrays to build commands in my library.
So to preserve memory, I have them put into flash, via PROGMEM ext,
typedef const char PROGMEM ProgChar;
ProgChar AT[] = "AT";
ProgChar AT_RST[] = "RST";

Then in my program I have it all go out to A port via:
*hws << AT << PLUS << CWMODE << EQUAL; //hws can be any Print type,

This is handled by overloading the << operator;
static Print &operator <<(Print &obj, ProgChar* arg) { 
  char pbuffbuffer[12]; //create a buffer,
  obj.print(loadProgmemVal(arg,pbuffbuffer)); //Load it, and then pass to obj print method.
  return obj; 
}

But this also overloads the << operator for all const char* Which makes me have to do a workaround:
hws->print(1); //HACK

At first, I thought I would overload the operator to handle both a char* and a Prog Char Object, But unfortunately, they are both treated as the same thing at run-time which makes that idea useless.
So after snooping I find the __FlashStringHelper type and macro. Which would allow me to have a sepperate type for these variables, and allow me to overload.
But the problem is, I cant find a good way to Create these:
const __FlashStringHelper MYVAR = F("Some text to be progchared");

Does not compile =/
Now I could probably make some helper method to load them all in, but that is just patching a hack with another hack... Is there any Clean way to do this? So I can use << for all types,
*hws << AT << PLUS << CWMODE << EQUAL << 1 << "\r\n"; //1 and Return break...


user28729: Is this legal?
typedef const char ProgChar;
ProgChar AT[] = "AT";

I would think that the PROGMEM can't be in the typedef, i.e.:
typedef const char ProgChar;
ProgChar AT[] PROGMEM = "AT";


21651: <p>So I have a Bunch of commonly used char arrays to build commands in my library.
So to preserve memory, I have them put into flash, via PROGMEM ext,</p>

<pre><code>typedef const char PROGMEM ProgChar;
ProgChar AT[] = "AT";
ProgChar AT_RST[] = "RST";
</code></pre>

<p>Then in my program I have it all go out to A port via:</p>

<pre><code>*hws &lt;&lt; AT &lt;&lt; PLUS &lt;&lt; CWMODE &lt;&lt; EQUAL; //hws can be any Print type,
</code></pre>

<p>This is handled by overloading the &lt;&lt; operator;</p>

<pre><code>static Print &amp;operator &lt;&lt;(Print &amp;obj, ProgChar* arg) { 
  char pbuffbuffer[12]; //create a buffer,
  obj.print(loadProgmemVal(arg,pbuffbuffer)); //Load it, and then pass to obj print method.
  return obj; 
}
</code></pre>

<p>But this also overloads the &lt;&lt; operator for all const char* Which makes me have to do a workaround:</p>

<pre><code>hws-&gt;print(1); //HACK
</code></pre>

<p>At first, I thought I would overload the operator to handle both a char* and a Prog Char Object, But unfortunately, they are both treated as the same thing at run-time which makes that idea useless.</p>

<p>So after snooping I find the __FlashStringHelper type and macro. Which would allow me to have a sepperate type for these variables, and allow me to overload.</p>

<p>But the problem is, I cant find a good way to Create these:</p>

<pre><code>const __FlashStringHelper MYVAR = F("Some text to be progchared");
</code></pre>

<p>Does not compile =/</p>

<p>Now I could probably make some helper method to load them all in, but that is just patching a hack with another hack... Is there any Clean way to do this? So I can use &lt;&lt; for all types,</p>

<pre><code>*hws &lt;&lt; AT &lt;&lt; PLUS &lt;&lt; CWMODE &lt;&lt; EQUAL &lt;&lt; 1 &lt;&lt; "\r\n"; //1 and Return break...
</code></pre>
 28729: <p>Is this legal?</p>

<pre><code>typedef const char ProgChar;
ProgChar AT[] = "AT";
</code></pre>

<p>I would think that the PROGMEM can't be in the typedef, i.e.:</p>

<pre><code>typedef const char ProgChar;
ProgChar AT[] PROGMEM = "AT";
</code></pre>
