Including files in exe

This is a discussion on Including files in exe within the C Programming forums, part of the General Programming Boards category; Say I want to include a .bmp file in my exe to be displayed on screen. How does the bmp ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    2

    Including files in exe

    Say I want to include a .bmp file in my exe to be displayed on screen. How does the bmp file get linked to my code? A simple #include "bmpfile"? If that's the case, how do I know where the bmp file is in memory?

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    starting off with basics, do you know how to load a bitmap from an external file and display it on screen? if not, begin with that
    hello, internet!

  3. #3
    ggs
    ggs is offline
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    A good, but non portable way of doing this might be to use an assembler such as NASM to do this.

    for instance, you can do this:

    Code:
    [section .data]
    
    global _animage
    
    _animage:
    %incbin "image.bmp"
    And a C header file to go with it:

    Code:
    #ifndef IMAGE_H
    #define IMAGE_H
    
    extern char *animage;
    
    #endif
    Produce an object for the assembly file.

    You can use the pointer animage to access the bitmap, just know the filesize before you use it (maybe the bitmap will tell you this?)

    When you link up all the objects, including the object from the assembly code, your program should work fine.
    .sect signature

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. including header files and implementation
    By steve1_rm in forum C Programming
    Replies: 4
    Last Post: 01-12-2009, 07:59 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  3. How to append bmp files to an EXE?
    By JoeDDDDYYY in forum C++ Programming
    Replies: 4
    Last Post: 01-28-2003, 01:24 PM
  4. How to link bpl files into exe?
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 10:38 AM
  5. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 08:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21