Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why would one want to embed data into the executable rather than read it from a file?

C23 will be supporting #embed allowing embedding data into an executable to be easier. My question is, however, why would one want to do that? Why not just read it from a file?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If the data should not change after the program is created it makes sense to bundle it with the executable.

An example of this is windows resources (which don’t use the new #embed mechanism because it long predates #embed). The resource mechanism allows data such as bitmaps, icons, menus, dialog layout and other static data needed for program operation to be bundled into the program in a way easy for the program to retrieve at run-time. Other systems have similar mechanisms.

Files make sense when the data should be easily changed (such as configuration data), but when the data is needed for the program to operate at all it should be made difficult for a user to change.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading