Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

I need to display a simple .gif image in C++

This may be a very novice question, I'm not sure.  Currently I am taking a basic C++ programming class, and we are required to make a game.  I would like to include .gif images in it.
The problem is this: every solution that I have found on the net will only display the image if the program is made into a binary executable file.  I am running Borland Turbo C++ 3.0.  The image is usually distorted when I run the program straight from Turbo, or I recieve many errors.  It runs fine from an executable.  I would like to know why this occurs, if it's not too much trouble.  Is there a way that I can work around this, or is Turbo an inadequate application for this purpose?  Thank you in advance for any responses.
  • 2
1 Solution
You won't have much luck.  GIF is a patented format, so usually, unless you can find someone posting code to read the files (which is technically illegal), you'll have to purchase a 3rd party reader which usually comes with the licensing from UNISYS.

Turbo C++ is also not going to be very accomodating for this either.

I used to use Turbo C++ for DOS in high school, and to facilitate using nicer graphics than line/point/circle, I cracked the BMP format, and then converted them to my own format which I could render easily.

There should be extensive information on the graphics format on the web.  There's probably also info on JPG, but that is a much more complicated format, and harder to code.
If you are going to make a Game, I could recomend you to use Bitmaps instead. All my games are developed with Bitmaps, But the games does just run under Windows, so if you are going to write it for Linux or some other, use PING.

So if I where you, I would reconsider the choose of gif images.
zshipleyAuthor Commented:
Thank you for your fast response.

This explains the BMP format and has some sample code.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now