How do I write a program that copies itself completely?
I have this extra credit assignment that is to write a program that completely copies itself - and I mean completely - every character. Does anyone know how to do that? If you have an idea, PLEASE notify me ASAP. So you know you aren't violating any ethics, the prof. said we could find the info. anywhere we can. My e-mail address is [email protected]. Thanks and hope to hear from you soon.
Hint: the System.out.println("..."); command is evidently the method to accomplish this task, but you cannot simply copy the program and paste it into the quotation marks, because as you will soon realize, you will be missing the one System.out.println("..."); command that printed the program... Good luck!
Re: How do I write a program that copies itself completely?
Actually, you could do this without the use of System.out.println().
Create an instance of FileOutputStream and one of FileInputStream. With the FileInputStream, open the file your program is contained in. Then write it out to the new file using FileOutputStream.
-------------------------------------------
weaver
icq# 64665116
Please rate this post.
http://weaver.x7.htmlplanet.com