Forcing printf to ignore formatting
<p>I'm using the pdcurses library and I'm writing a function which moves a line on the screen up one. This involves copying the current line and then pasting it above. The problem is that the curses function for printing whole lines, <code>printw</code>, uses the same format strings as <code>printf</code>. These lines could contain percentage signs, and so once pasted those signs are of course lost. </p>

<blockquote>
  <p>The printw() functions add a formatted string to the window at 
      the current or specified cursor position. The format strings are 
      the same as used in the standard C library's printf(). (printw() 
      can be used as a drop-in replacement for printf().)</p>
</blockquote>

<p>A small example would be:</p>

<pre><code>chtype p[200]; 
winchnstr(w, p, 200); //obtain the line
clrtoeol(); //remove the line

wmove(w, y-1, x); //move up a line
clrtoeol(); //erase the line
wprintw(w, p); //print the new line
</code></pre>

<p>Is there any way to force printf to treat the percentage signs as normal without having to go through <code>p</code> and inserting a percentage sign between every one? That seems a rather annoying for something so simple. </p>

<p>The first solution would be to convert <code>p</code> to a string, iterate through the string, and insert a <code>%</code> behind every <code>%</code>. But when I moving lots of lines at once (I'm trying to create an effect of the screen moving "upwards") this might not be the best solution performance-wise, would it?</p>

<p>The other solution would instead iterate through <code>p</code> and just use <code>addch()</code> to add each character separately. But would this lose performance/efficiency in comparison to <code>wprintw</code>? Or is <code>wprintw</code> simply a glorified version of just pasting each character individually? Are these really the only two options I have?</p>