Including a JPEG file

How to include a jpeg file into a c++ program??
You need to use an API, as core c++ doesn't support it. I'm not sure what you need to be loading the jpeg for so hard to say what API you should use.
Do you mean embedding into executable itself and access it at runtime as a unsigned char* of a known size ?

If so, then open the jpeg file in a hex editor and export them as a unsigned char* (Hex Workshop for example has this option, not all hex editors have it).

Another idea is to use convert utility from ImageMagick and convert jpeg to a XPM file, which is just that: a C style header.
Topic archived. No new replies allowed.