保存可执行数据 [英] Save data in executable
问题描述
我有一个可移植的可执行文件,将数据保存在同一文件夹中的可执行文件。有什么办法,我可以将数据存入对应的可执行文件,当我关闭该应用程序?
I have a portable executable that saves data to a file in the same folder as the executable. Is there any way that I can save data into the executable itself when I close the app?
这或许不可思议,但我拍摄的数据,并只有一个文件exe文件和数据将是巨大的。
This maybe weird, but taking the data with me and only have one file for the exe and data would be great.
宁愿如果这是用C#做,但不是必要条件。
Would prefer if this was made with C#, but is not a requisite.
推荐答案
您不能修改自己的EXE包含在任何存储的数据接近一个优雅或紧凑的方式。首先,操作系统获得的EXE文件的锁,而其中所包含的应用程序正在运行。其次,一个EXE是预编译的(成MSIL至少),以及文件的源数据的修改通常需要重新编译以将各种指针代码处理,否则,你在做什么在一个非常深奥的水平了严重的知识该文件。
You cannot modify your own EXE to contain stored data in anything approaching an elegant or compact way. First off, the OS obtains a lock on the EXE file while the application contained within is being run. Second, an EXE comes pre-compiled (into MSIL at least), and modification of the file's source data usually requires recompilation to reset various pointers to code handles, or else a SERIOUS knowledge on a very esoteric level about what you're doing to the file.
普遍接受的方法是应用程序配置文件,资源文件,也创建/读取一些自定义的文件/修改在运行时,像你现在做的事情。两个文件的应用程序不应该引起关注。
The generally-accepted methods are the application config file, a resource file, or some custom file you create/read/modify at runtime, like you're doing now. Two files for an application should not be cause for concern
这篇关于保存可执行数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!