在C中合并二进制文件

编程入门 行业动态 更新时间:2024-10-28 06:27:35
本文介绍了在C中合并二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

以下是我的情况. 执行时a.out产生以下输出. 文件1是输出" b.out执行时会产生以下输出. 文件2是输出" 我要做的只是一个二进制合并,在这种情况下,合并的输出应该 给出如下输出 文件1是输出" 文件2是输出" 如何在Linux或Windows上的C语言中实现此目标? 请:)

解决方案

感谢您的澄清.这没有任何意义,也是不可能的.我可以解释为什么,但这太无聊了.无论如何,没用的想法是错误的.在某种程度上,您可以反编译可执行模块并将其编译为单个可执行文件,但是由于可能发生名称冲突,因此不能保证成功,而且也不容易,并且没有任何实际意义. 我建议您阅读一般程序设计,然后学习源代码,目标文件和可执行文件,入口点,地址空间,应用程序加载和地址解析的概念.这个问题是基于围绕这些领域的一些误解.
—SA

如果要使用两个可执行文件的功能,为什么不直接从一个点运行两个可执行文件.对于像这样的简单事情,脚本是一个不错的选择... 批次 [ ^ ](适用于Windows)或 bash [ ^ ](对于UNIX/Linux)是两种常用的脚本语言,使高级用户可以执行此类操作.每个脚本都可以在各自的环境中本地运行,如果您想要一个脚本在任何一个平台上运行,则可以使用其他多平台脚本选项之一(Perl,Python等).

<您想合并可执行文件吗?您是否正在寻找应用二进制补丁的软件? 像这样吗? 二进制diff/patch实用程序

Hi, Below is my scenario. a.out on execution produces the below output. "File-1 is the output" b.out on execution produces the below output. "File-2 is the output" All i want to do is a binary merge and in this case the merged output should give output as below "File-1 is the output" "File-2 is the output" How can i achieve this in C on linux or windows please :)

解决方案

Thank you for the clarification. It does not make any sense and is not possible. I can explain why, but this is too boring. Wrong useless idea anyway. In a way, you can decompile executable modules and compile it in a single executable, but it is not guaranteed to succeed due to possible name clash, and not easy, and makes no practical sense. [EDIT] I would suggest you read on general programming and lean about the concepts of source, object and executable files, entry points, address spaces, application loading and resolution of addresses. The question is based on some misconceptions around these areas.
—SA

If you want the functionality of two executables, why not simply run both from a single point. Scripts are a great option for something simple like this... Batch[^] (for Windows) or bash[^] (for UNIX/Linux) are two commonly used scripting languages that enable power users to do this type of thing. Each runs pretty much natively in their environment, if you want a script that runs on either platform, then go with one of the other multi-platform scripting options (Perl, Python, etc.).

You want to merge executable files? Are you looking for software to apply binary patches? Something like this? Binary diff/patch utility

更多推荐

在C中合并二进制文件

本文发布于:2023-07-26 09:24:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1215489.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:二进制文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!