I love graphics programming through C & C++, I have worked a lot, but i am still very far away from bmp files, Can any one tell me how i can access bmp file through C, C++.
Thanks in advance :rolleyes:

I love graphics programming through C & C++, I have worked a lot, but i am still very far away from bmp files, Can any one tell me how i can access bmp file through C, C++.
Thanks in advance :rolleyes:

First you have to know the format of a bitmap file. Read this: http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html

If you just want to view images, there is a simple C code snippet on DaniWeb:
http://www.daniweb.com/code/snippet86.html

It's called "Displaying a JPEG image using Windows GUI", it will also display BMP and other images.

one easy way to do it is,

declare image and header array;

unsigned char Header[0x435],image[256][256];

and to read image;

fread(Header,1,0x435,fp);	// copy image header to Header array
		fseek(fp,0x436,SEEK_SET);	// Move file pointer to start of image data
		fread(image,1,256*256,fp);	// read image data and copy to ImageIn1[][] array

		fclose(fp);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.