Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
A question about storing files in applications Posted by jobromedia on 2 Dec 2005 at 10:25 PM
What's the simpliest most efficient way to store a file in an application? Is it in a blob or what?

And how do I get this file out as a constant if necesery?
Report
Re: A question about storing files in applications Posted by zibadian on 3 Dec 2005 at 1:43 AM
: What's the simpliest most efficient way to store a file in an application? Is it in a blob or what?
:
: And how do I get this file out as a constant if necesery?
:
I usually append the file at the end of the executable itself. This way it becomes a kind of resource. Then you can read the executable from the final byte of the compiled executable to the end of the file.
Report
Re: A question about storing files in applications Posted by jobromedia on 3 Dec 2005 at 12:36 PM
: : What's the simpliest most efficient way to store a file in an application? Is it in a blob or what?
: :
: : And how do I get this file out as a constant if necesery?
: :
: I usually append the file at the end of the executable itself. This way it becomes a kind of resource. Then you can read the executable from the final byte of the compiled executable to the end of the file.
:
How do I do that?
Report
Re: A question about storing files in applications Posted by zibadian on 3 Dec 2005 at 11:20 PM
: : : What's the simpliest most efficient way to store a file in an application? Is it in a blob or what?
: : :
: : : And how do I get this file out as a constant if necesery?
: : :
: : I usually append the file at the end of the executable itself. This way it becomes a kind of resource. Then you can read the executable from the final byte of the compiled executable to the end of the file.
: :
: How do I do that?
:
Open the executable using a TFileStream. Seek the end of the file, and write the data-file to that stream. The best way is to use some recognizable prefix to separate the executable from the data-file.
When the executable runs, open itself as a data file, then find that prefix and read the data-file.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.