A question about storing files in applications - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

A question about storing files in applications

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?

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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.
  • jobromediajobromedia Posts: 168Member
    : : 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?
  • zibadianzibadian Posts: 6,349Member
    : : : 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.
Sign In or Register to comment.