PDA

View Full Version : Printing out a BMP Header file.



kiock
04-28-2006, 10:04 AM
I know this is probably the simplest thing to do with openGL, but I can't seem to find the answer anywhere.

How can I printout the contents of a BMP Header file.

So when the program reads it, to display the BMP it also displays it, or saves it in a .txt file.

On the net I can only seem to find material that describes a BMP header file, not how to print one out.

All help is welcome, thank you for your time!

zed
04-28-2006, 06:20 PM
nothing to do with gl but
one method would be
u have to read the image header into a structure
eg
struct BMP_Heaer
{
int width, height, bit_depth;
};

FILE *f = fopen( "name.txt", wt );
fprintf( f, "width:%d\n", header.width );

// wont work u can check the file stuff in the c spec

for c++ u would use streams

Joe the Programmer
04-29-2006, 07:55 PM
I'm not sure if you already know this, but the stream you use in C++ is

#include <fstream.h>

ifstream thefile("path.txt");

// do your stream stuff here