save pixel array to jpeg image file c++
<p>i have a pixel array containing the values from 0 to 255 ...
i have passed it to my c++ function ...
this pixel array i want to save it to jpeg image file...</p>

<p>how to do it with correct encoding ??</p>

<p>i have converted the array to binary string 
 and saved it into the file in the below code but it just saves an empty image of 4 byte size ...</p>

<pre><code>    FILE *file = fopen("/media/internal/wallpapers/04.jpeg", "w+");
    fwrite(binaryStr , 1 , sizeof(binaryStr) ,file );    

    fclose(file);
</code></pre>

<p>thnks </p>
