How to import a data to executable program?

Discussion in 'C Programming' started by fobus, Jul 23, 2007.

  1. fobus

    fobus Guest

    I want to import some sound files to executable file. And also I want
    to know that imports adress and size. How can I import a data to
    executable file?

    Thanks
    Kervan ASLAN
     
    fobus, Jul 23, 2007
    #1
    1. Advertising

  2. fobus

    Jack Klein Guest

    On Sun, 22 Jul 2007 16:22:35 -0700, fobus <> wrote in
    comp.lang.c:

    > I want to import some sound files to executable file. And also I want
    > to know that imports adress and size. How can I import a data to
    > executable file?


    C doesn't "import" anything. If you want to read the data from these
    files, open your C reference and look up the functions fopen() and
    fread(). You would probably need to use binary mode for sound files.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Jul 23, 2007
    #2
    1. Advertising

  3. fobus

    fobus Guest

    On 23 Temmuz, 05:24, Jack Klein <> wrote:
    > On Sun, 22 Jul 2007 16:22:35 -0700, fobus <> wrote in
    > comp.lang.c:
    >
    > > I want to import some sound files to executable file. And also I want
    > > to know that imports adress and size. How can I import a data to
    > > executable file?

    >
    > C doesn't "import" anything. If you want to read the data from these
    > files, open your C reference and look up the functions fopen() and
    > fread(). You would probably need to use binary mode for sound files.
    >
    > --
    > Jack Klein
    > Home:http://JK-Technology.Com
    > FAQs for
    > comp.lang.chttp://c-faq.com/
    > comp.lang.c++http://www.parashift.com/c -faq-lite/
    > alt.comp.lang.learn.c-c++http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html


    But can show some images on buttons(I talk about gtk and Borland C++)
    And we don't read an external file. I think those image files included
    to Executable file. I know that fopen, and fread uses for external
    files.
     
    fobus, Jul 23, 2007
    #3
  4. fobus

    santosh Guest

    fobus wrote:

    > On 23 Temmuz, 05:24, Jack Klein <> wrote:
    >> On Sun, 22 Jul 2007 16:22:35 -0700, fobus <> wrote in
    >> comp.lang.c:
    >>
    >> > I want to import some sound files to executable file. And also I want
    >> > to know that imports adress and size. How can I import a data to
    >> > executable file?

    >>
    >> C doesn't "import" anything. If you want to read the data from these
    >> files, open your C reference and look up the functions fopen() and
    >> fread(). You would probably need to use binary mode for sound files.
    >>
    >> --
    >> Jack Klein
    >> Home:http://JK-Technology.Com
    >> FAQs for
    >> comp.lang.chttp://c-faq.com/
    >> comp.lang.c++http://www.parashift.com/c -faq-lite/
    >>alt.comp.lang.learn.c-c++http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html


    Please don't quote signature blocks unnecessarily.

    > But can show some images on buttons(I talk about gtk and Borland C++)
    > And we don't read an external file. I think those image files included
    > to Executable file. I know that fopen, and fread uses for external
    > files.


    This will be specific for each platform or GUI toolkit. Posting to a
    platform or toolkit specific group would be better.
     
    santosh, Jul 23, 2007
    #4
  5. "fobus" <> wrote in message
    It's trivial to write a "dumptoC" program. If you on my website you'll see a
    csvtoC struct program that does essentially the same thing, but with
    tablular data instead of flat objects like sound files.

    You just print the data as a global C array, and it can then be added as a
    source file to the program. This is one case where use of a global is
    necessary.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm McLean, Jul 24, 2007
    #5
  6. fobus

    Guest

    On 7 23 , 7 22 , fobus <> wrote:
    > I want to import some sound files to executable file. And also I want
    > to know that imports adress and size. How can I import a data to
    > executable file?
    >
    > Thanks
    > Kervan ASLAN


    For Windows Applications, there is an easy way.
    You can use resources.
    Add your sound files to the resource file. And when you need to use
    it, you can use LoadResource(to load it), LockResource(to get the
    address) and SizeofResource(to get the size) functions.

    However, this way is not available on other platforms.
     
    , Jul 26, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    15
    Views:
    491
    Dave Thompson
    Aug 21, 2006
  2. pratap
    Replies:
    20
    Views:
    760
    Flash Gordon
    Mar 7, 2007
  3. Jason Cavett
    Replies:
    8
    Views:
    622
    Sanjay
    May 16, 2007
  4. Replies:
    2
    Views:
    341
    Florian Schmidt
    Oct 4, 2007
  5. Replies:
    0
    Views:
    443
Loading...

Share This Page