<p>I am trying to populate a string with a double value using a <code>sprintf</code> like this:</p>

<pre><code>sprintf(S, "%f", val);
</code></pre>

<p>But the precision is being cut off to six decimal places. I need about 10 decimal places for the precision.</p>

<p>How can that be achieved?</p>

What you want is a modifier:
```
```
sprintf(S, "%.10f", val);
```
```
man sprintf will have many more details on format specifiers.