Copying binary jpg data into a buffer
<pre><code>void jpgToBuff(const char* srcfilename)
{

    FILE* file = fopen(srcfilename, "rb");
    fseek(file, 0, SEEK_END);
    unsigned long fileLen = ftell(file);
    fseek(file, 0, SEEK_SET);
    char* file_data;
    file_data = (char *)malloc((fileLen + 1) * sizeof(char));
    fread(file_data, fileLen, 1, file);
    fclose(file);
}
</code></pre>

<p>Am I doing this correctly. I want to eventually send this information through a socket and decode it on the other side. Any suggestions would be super helpful. Is this theoretically possible to send this through a socket and decode it into an image on the other side?</p>