Results 1 to 3 of 3

Thread: Printing out a BMP Header file.

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2006
    Location
    UK
    Posts
    6

    Printing out a BMP Header file.

    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!

  2. #2
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Printing out a BMP Header file.

    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

  3. #3
    Member Newbie
    Join Date
    Jan 2006
    Location
    Pacific Northwest
    Posts
    38

    Re: Printing out a BMP Header file.

    I'm not sure if you already know this, but the stream you use in C++ is
    Code :
    #include <fstream.h>
     
    ifstream thefile("path.txt");
     
    // do your stream stuff here
    "The first person to succeed is the first person to make 100 mistakes" - Albert Einstien

Similar Threads

  1. File reading and printing in openGL
    By master21 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-06-2017, 02:57 AM
  2. header file in kernel file
    By agmegharaj in forum OpenCL
    Replies: 1
    Last Post: 08-30-2011, 03:11 AM
  3. File reading and printing in openGL
    By Timkee in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-13-2011, 04:44 AM
  4. EGL 1.2 Header file
    By Nils Pipenbrinck in forum EGL
    Replies: 3
    Last Post: 10-04-2006, 03:00 PM
  5. EGL 1.2 .h header file
    By PeterM in forum EGL
    Replies: 2
    Last Post: 04-09-2006, 08:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean