 <p>Assuming you have an image called <code>image.jpg</code>, paste this into a file called <code>go</code>, then type</p> <pre><code>php -f go </code></pre> <p>and you will see what your C++ should generate:</p> <pre><code>&lt;?php header("Content-type: image/jpeg"); readfile('image.jpg'); ?&gt; </code></pre>