Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to import a data to executable program?

Reply
Thread Tools

How to import a data to executable program?

 
 
fobus
Guest
Posts: n/a
 
      07-22-2007
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

 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      07-23-2007
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
 
Reply With Quote
 
 
 
 
fobus
Guest
Posts: n/a
 
      07-23-2007
On 23 Temmuz, 05:24, Jack Klein <jackkl...@spamcop.net> wrote:
> On Sun, 22 Jul 2007 16:22:35 -0700, fobus <fo...@mynet.com> 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.

 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      07-23-2007
fobus wrote:

> On 23 Temmuz, 05:24, Jack Klein <jackkl...@spamcop.net> wrote:
>> On Sun, 22 Jul 2007 16:22:35 -0700, fobus <fo...@mynet.com> 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.

 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      07-24-2007

"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


 
Reply With Quote
 
dmtabs12@gmail.com
Guest
Posts: n/a
 
      07-26-2007
On 7 23 , 7 22 , fobus <fo...@mynet.com> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Create executable from executable with py2exe vedrandekovic@gmail.com Python 0 03-29-2008 12:23 PM
Running an Executable Before Executable JAR Jason Cavett Java 8 05-16-2007 07:14 PM
what is fast dynamically linked executable or statically linked executable ?how to decide? pratap C Programming 20 03-07-2007 04:46 AM
How can I run a c executable in pwd ,while the executable is in some other directory vishsid3@gmail.com C Programming 15 08-21-2006 06:04 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57