Hello.
Question.
Lets say I write an executable program that is supposed to do
A+B+C
but i made a mistake and it does
A+B-C
and i only discovered this error after i built the program and sold it so someone.
how do i write a separate executable / patch i can send to the person that will correct that error IN c++.
Thank YOU
|
Pro contributor
|
![]() |
| 21Nov2010,20:11 | #2 |
|
send him the executable file to overwrite the wrong one
|
|
Go4Expert Member
|
|
| 21Nov2010,20:12 | #3 |
|
well yes...but...im thinking if its a big program. Cant I just write up a little code that will do that?instead of the WHOleeeee Executable?
|
|
Pro contributor
|
![]() |
| 21Nov2010,20:23 | #4 |
|
then try the patch method
read both files and find the differences(what the difference is and where) write the data in a file and send this with an exe patcher program to issue the changes to the old program |
|
Go4Expert Member
|
|
| 21Nov2010,20:26 | #5 |
|
ok with this patch method if you have four forms will you be able to specify that you only want to check out the code on the 1st form?
|
|
Banned
|
|
| 21Nov2010,22:06 | #6 |
|
thanks
|
|
Go4Expert Member
|
|
| 21Nov2010,22:50 | #7 |
|
Pro contributor
|
![]() |
| 22Nov2010,00:05 | #8 |
|
Go4Expert Member
|
|
| 22Nov2010,00:15 | #9 |
|
ok so i must redo the whole executable?
|
|
Pro contributor
|
![]() |
| 22Nov2010,00:58 | #10 |
|
this is patch1.cpp
Code:
#include <stdio.h>
int main(){
int A=1,B=2,C=0;
C=A+B;
printf("\nC=%d",C);
getchar();
return 0;
}
this patch2.cpp Code:
#include <stdio.h>
int main(){
int A=1,B=2,C=0;
C=A-B;
printf("\nC=%d",C);
getchar();
return 0;
}
patch2.cpp is the program with the error and patch1.cpp is the correct one you compile both of them if you see the executables in a hex editor and compare them with each other you will see that most of the files are the same. you need to change only the differences in dos prompt you can use fc=filecompare like this fc patch1.exe patch2.exe >differences.txt in this text file you will see what you have to change in patch2.exe in order to become patch1.exe see the files in the zip file. p.s. all the above must be done programatically by you or you can use something like this to do it automatically http://sourceforge.net/projects/jojodiff/ also another article based on what you want is here http://www.codediesel.com/tools/tran...files-quickly/ Last edited by virxen; 22Nov2010 at 01:01..
shabbir
like this
|


