Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Copy an .exe to a new .exe file using C/C++

Let there be an executable file say, t1.exe. If I run t1.exe then it shall copy itself to a new executable file say t2.exe.



void main()
FILE *fp,*tp;
unsigned long int t=0;
unsigned long int pos=ftell(fp);

printf("End of t1");

t2.exe is created but when I run this it says "t2 has stopped working." I'm using Windows 7(Home Basic) 64bit. The program is compiled with Borland C++ V. 5.02.
Amazingly, both these files have same size (in bytes).

[b]Please reply fast!!! It's URGENT....!!!![/b]
Sign In or Register to comment.