Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
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 :)
Posted
Comments
pasztorpisti 14-Aug-12 13:35pm    
Its unclear what is your goal. Noone will be able to answer this, only guessing is possible. Please make your intentions clear.
Sergey Alexandrovich Kryukov 14-Aug-12 13:38pm    
And not clear what's the problem. Merge them the way you want...
--SA
[no name] 14-Aug-12 13:42pm    
but the output is not expected even though the final merged .out file is the sum of the individual .out files
[no name] 14-Aug-12 13:42pm    
typo....the output is not as expected
Sergey Alexandrovich Kryukov 14-Aug-12 15:16pm    
How do you define this "sum"? And what's the problem?
--SA

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
 
Share this answer
 
v2
Comments
pasztorpisti 14-Aug-12 15:43pm    
+5 I was afraid of that this is the goal...
Sergey Alexandrovich Kryukov 14-Aug-12 15:49pm    
Thank you. What do you afraid of? What goal? I did not get it.
--SA
pasztorpisti 14-Aug-12 16:25pm    
Yep, the pointless goal of merging binaries.
Albert Holguin 14-Aug-12 19:57pm    
Pointless to try to merge binaries, but I gave him an option that should make more sense.
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.).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Aug-12 0:02am    
At least it makes some sense. My 5.
--SA
You want to merge executable files? Are you looking for software to apply binary patches?

Something like this?
Binary diff/patch utility
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900