How to import a data to executable program?

F

fobus

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
 
J

Jack Klein

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
 
F

fobus

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.
 
S

santosh

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.
 
M

Malcolm McLean

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.
 
D

dmtabs12

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top